36 lines
973 B
Python
36 lines
973 B
Python
"""Application configuration."""
|
|
import os
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
|
|
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
|
|
class Config:
|
|
SECRET_KEY = os.environ.get("SECRET_KEY", "change-me-in-production")
|
|
SQLALCHEMY_DATABASE_URI = os.environ.get(
|
|
"DATABASE_URL",
|
|
f"sqlite:///{os.path.join(BASE_DIR, 'instance', 'location_mgmt.db')}"
|
|
)
|
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
|
# How often (seconds) the board poller updates relay states in the background
|
|
BOARD_POLL_INTERVAL = int(os.environ.get("BOARD_POLL_INTERVAL", 10))
|
|
# Base URL this server is reachable at (boards will POST webhooks here)
|
|
SERVER_BASE_URL = os.environ.get("SERVER_BASE_URL", "http://localhost:5000")
|
|
|
|
|
|
class DevelopmentConfig(Config):
|
|
DEBUG = True
|
|
|
|
|
|
class ProductionConfig(Config):
|
|
DEBUG = False
|
|
|
|
|
|
config_map = {
|
|
"development": DevelopmentConfig,
|
|
"production": ProductionConfig,
|
|
"default": DevelopmentConfig,
|
|
}
|