Moved !secret from config.json to only secrets.json

This commit is contained in:
Mathieu 2021-09-13 22:09:43 +02:00
parent e8af85e0d5
commit af81c42f4e
2 changed files with 5 additions and 5 deletions

View File

@ -2,7 +2,6 @@
"PORT": 5000, "PORT": 5000,
"12HOURS-FORMAT": false, "12HOURS-FORMAT": false,
"LANGUAGE": "fr-fr", "LANGUAGE": "fr-fr",
"SPOTIFY_CLIENT_ID": "!secret SPOTIFY_CLIENT_ID", "TTS_VOICE": "marytts:upmc-pierre-hsmm",
"SPOTIFY_CLIENT_SECRET": "!secret SPOTIFY_CLIENT_SECRET", "PAUSE_MUSIC_AFTER_HOTWORD": true
"TTS_VOICE": "marytts:upmc-pierre-hsmm"
} }

View File

@ -11,13 +11,14 @@ def get_in_config(name):
if name in config_json: if name in config_json:
if isinstance(config_json.get(name), str): if isinstance(config_json.get(name), str):
if "!secret" in config_json.get(name): if "!secret" in config_json.get(name):
# secret_name = config_json.get(name).removeprefix('!secret ')
secret_name = config_json.get(name).replace('!secret ', '') secret_name = config_json.get(name).replace('!secret ', '')
return get_in_secret(secret_name) return get_in_secret(secret_name)
else: else:
return config_json.get(name) return config_json.get(name)
else: else:
return config_json.get(name) return config_json.get(name)
else:
return get_in_secret(name)
def get_in_secret(secret_name): def get_in_secret(secret_name):
@ -26,4 +27,4 @@ def get_in_secret(secret_name):
if secret_name in secrets_json: if secret_name in secrets_json:
return secrets_json.get(secret_name) return secrets_json.get(secret_name)
else: else:
return "Not found!" return None