| 1234567891011121314151617181920212223242526 |
- """Local configuration helpers.
- Secrets are read from environment variables or local_config.json. The local
- config file is intentionally gitignored.
- """
- import json
- import os
- HERE = os.path.dirname(os.path.abspath(__file__))
- LOCAL_CONFIG_PATH = os.path.join(HERE, "local_config.json")
- def _local_config():
- try:
- with open(LOCAL_CONFIG_PATH, encoding="utf-8") as f:
- return json.load(f)
- except Exception:
- return {}
- _CONFIG = _local_config()
- def get(name, default=""):
- return os.environ.get(name) or _CONFIG.get(name) or default
|