Remove unused settings.
This commit is contained in:
parent
bdbbbaecaf
commit
86c37fa5b1
@ -1,10 +1,6 @@
|
|||||||
api_key: "FIXME"
|
api_key: "FIXME"
|
||||||
|
|
||||||
flask_settings_dev:
|
debug: False
|
||||||
DEBUG: True
|
|
||||||
|
|
||||||
flask_settings_prod:
|
|
||||||
DEBUG: False
|
|
||||||
|
|
||||||
targets:
|
targets:
|
||||||
- target_awake_temperature
|
- target_awake_temperature
|
||||||
|
@ -44,17 +44,12 @@ authorizations = {
|
|||||||
|
|
||||||
with open('./conf.yml') as conf:
|
with open('./conf.yml') as conf:
|
||||||
yaml_conf = yaml.safe_load(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")
|
api_key = yaml_conf.get("api_key")
|
||||||
if os.environ['FLASK_ENV'] == 'development':
|
if debug:
|
||||||
flask_settings_env = yaml_conf.get("flask_settings_dev")
|
logging.getLogger().setLevel(logging.DEBUG)
|
||||||
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)
|
|
||||||
else:
|
else:
|
||||||
logging.error("FLASK_ENV must be set to development or production.")
|
logging.getLogger().setLevel(logging.INFO)
|
||||||
sys.exit(1)
|
|
||||||
targets = yaml_conf.get("targets")
|
targets = yaml_conf.get("targets")
|
||||||
modes = yaml_conf.get("modes")
|
modes = yaml_conf.get("modes")
|
||||||
http_port = yaml_conf.get("http_port")
|
http_port = yaml_conf.get("http_port")
|
||||||
@ -175,8 +170,6 @@ signal.signal(signal.SIGTERM,handler)
|
|||||||
signal.signal(signal.SIGINT,handler)
|
signal.signal(signal.SIGINT,handler)
|
||||||
|
|
||||||
app = Flask(__name__)
|
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',
|
api = Api(app, version='1.0', title='Thermostat and load shedder',
|
||||||
description='API to read and set thermostat.', authorizations=authorizations)
|
description='API to read and set thermostat.', authorizations=authorizations)
|
||||||
ns_thermostat = api.namespace('thermostat/', description='Thermostat API')
|
ns_thermostat = api.namespace('thermostat/', description='Thermostat API')
|
||||||
|
Loading…
Reference in New Issue
Block a user