Development

This commit is contained in:
Matthew Grotke 2026-06-07 16:27:16 -04:00
parent 19f0bfa79c
commit 687e0a66d1
8 changed files with 142 additions and 1 deletions

View file

@ -0,0 +1,23 @@
import copy, json, os
CONFIGS_DIR = '/routlin_location'
CONFIG_FILE = f'{CONFIGS_DIR}/config.json'
CAPTIVE_QUEUE = f'{CONFIGS_DIR}/.captive-queue'
_config_cache = None
_config_mtime = None
def load_config():
global _config_cache, _config_mtime
try:
mtime = os.path.getmtime(CONFIG_FILE)
if _config_cache is not None and mtime == _config_mtime:
return copy.deepcopy(_config_cache)
with open(CONFIG_FILE) as f:
data = json.load(f)
_config_cache = data
_config_mtime = mtime
return copy.deepcopy(data)
except Exception:
return {}