From 03c4eaf058a0860a26191411351df01e099d780e Mon Sep 17 00:00:00 2001 From: AaronDewes Date: Fri, 9 Sep 2022 10:10:09 +0000 Subject: [PATCH] Move dotenv loading to get_var --- app/lib/manage.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/lib/manage.py b/app/lib/manage.py index 8d75774..ded6019 100644 --- a/app/lib/manage.py +++ b/app/lib/manage.py @@ -81,6 +81,10 @@ def getArguments(): return arguments def get_var(var_name): + if os.path.isfile(dotCitadelPath): + dotenv=parse_dotenv(os.path.join(nodeRoot, "..", ".env")) + else: + dotenv=parse_dotenv(os.path.join(nodeRoot, ".env")) if var_name in dotenv: return str(dotenv[var_name]) else: @@ -106,10 +110,6 @@ def handleAppV4(app): yaml.dump(resultYml["spec"], dockerComposeFile) torDaemons = ["torrc-apps", "torrc-apps-2", "torrc-apps-3"] torFileToAppend = torDaemons[random.randint(0, len(torDaemons) - 1)] - if os.path.isfile(dotCitadelPath): - dotenv=parse_dotenv(os.path.join(nodeRoot, "..", ".env")) - else: - dotenv=parse_dotenv(os.path.join(nodeRoot, ".env")) with open(os.path.join(nodeRoot, "tor", torFileToAppend), 'a') as f: f.write(replace_vars(resultYml["new_tor_entries"])) mainPort = resultYml["port"]