Remove unused settings.

This commit is contained in:
yohan 2024-06-08 10:06:39 +02:00
parent bdbbbaecaf
commit 86c37fa5b1
2 changed files with 5 additions and 16 deletions

View File

@ -1,10 +1,6 @@
api_key: "FIXME"
flask_settings_dev:
DEBUG: True
flask_settings_prod:
DEBUG: False
debug: False
targets:
- target_awake_temperature

View File

@ -44,17 +44,12 @@ authorizations = {
with open('./conf.yml') as conf:
yaml_conf = yaml.safe_load(conf)
flask_settings = yaml_conf.get("flask_settings")
debug = yaml_conf.get("debug")
api_key = yaml_conf.get("api_key")
if os.environ['FLASK_ENV'] == 'development':
flask_settings_env = yaml_conf.get("flask_settings_dev")
logging.getLogger().setLevel(logging.DEBUG)
elif os.environ['FLASK_ENV'] == 'production':
flask_settings_env = yaml_conf.get("flask_settings_prod")
logging.getLogger().setLevel(logging.INFO)
if debug:
logging.getLogger().setLevel(logging.DEBUG)
else:
logging.error("FLASK_ENV must be set to development or production.")
sys.exit(1)
logging.getLogger().setLevel(logging.INFO)
targets = yaml_conf.get("targets")
modes = yaml_conf.get("modes")
http_port = yaml_conf.get("http_port")
@ -175,8 +170,6 @@ signal.signal(signal.SIGTERM,handler)
signal.signal(signal.SIGINT,handler)
app = Flask(__name__)
app.config.from_mapping(flask_settings)
app.config.from_mapping(flask_settings_env)
api = Api(app, version='1.0', title='Thermostat and load shedder',
description='API to read and set thermostat.', authorizations=authorizations)
ns_thermostat = api.namespace('thermostat/', description='Thermostat API')