diff options
author | Parker <contact@pkrm.dev> | 2024-11-03 21:29:10 -0600 |
---|---|---|
committer | Parker <contact@pkrm.dev> | 2024-11-03 21:29:10 -0600 |
commit | 0b6dafec62f22383bf501e1594d3b9a8c93f2337 (patch) | |
tree | f812a72049d45e36b7fe3f05279413f312e357e9 /config.py | |
parent | 9e99695611527ec31c9a7c8660397f5230d5b7ba (diff) |
Fix link redirects and remove BASE_URL
Diffstat (limited to 'config.py')
-rw-r--r-- | config.py | 14 |
1 files changed, 2 insertions, 12 deletions
@@ -1,7 +1,6 @@ import jsonschema import os import yaml -import validators import sys import logging from colorlog import ColoredFormatter @@ -23,7 +22,6 @@ LOG = logging.getLogger("pythonConfig") LOG.setLevel(log_level) LOG.addHandler(stream) -BASE_URL = None IP_TO_LOCATION = None API_KEY = None @@ -33,11 +31,10 @@ schema = { "config": { "type": "object", "properties": { - "base_url": {"type": "string"}, "ip_to_location": {"type": "boolean"}, "api_key": {"type": "string"}, }, - "required": ["base_url", "ip_to_location"], + "required": ["ip_to_location"], } }, "required": ["config"], @@ -61,7 +58,6 @@ def load_config(): with open(file_path, "w") as f: f.write( """ - base_url: "" ip_to_location: "" api_key: "" """ @@ -75,7 +71,7 @@ def load_config(): # Validate the options within config.yaml def validate_config(file_contents): - global BASE_URL, IP_TO_LOCATION, API_KEY + global IP_TO_LOCATION, API_KEY config = yaml.safe_load(file_contents) try: @@ -84,12 +80,6 @@ def validate_config(file_contents): LOG.error(e.message) sys.exit() - # Validate BASE_URL - if not validators.url(config["config"]["base_url"]): - LOG.error("BASE_URL is not a valid URL") - else: - BASE_URL = config["config"]["base_url"] - # Make IP_TO_LOCATION a boolean IP_TO_LOCATION = bool(config["config"]["ip_to_location"]) |