bin2
This commit is contained in:
17
bin2/lib/config.py
Normal file
17
bin2/lib/config.py
Normal file
@@ -0,0 +1,17 @@
|
||||
DOCKERS_ENV = "/kaz/config/dockers.env"
|
||||
SECRETS = "/kaz/secret/env-{serv}"
|
||||
|
||||
def getDockersConfig(key):
|
||||
with open(DOCKERS_ENV) as config:
|
||||
for line in config:
|
||||
if line.startswith(f"{key}="):
|
||||
return line.split("=", 1)[1].split("#")[0].strip()
|
||||
raise Exception(f"getDockersConfig(): No config for {key}")
|
||||
|
||||
def getSecretConfig(serv, key):
|
||||
with open(SECRETS.format(serv=serv)) as config:
|
||||
for line in config:
|
||||
if line.startswith(f"{key}="):
|
||||
return line.split("=", 2)[1].split("#")[0].strip()
|
||||
raise Exception(f"getSecretConfig(): No config for {serv}/{key}")
|
||||
|
Reference in New Issue
Block a user