.
This commit is contained in:
@@ -7,14 +7,15 @@ file_path="/etc/app/config.yaml"
|
|||||||
config=None
|
config=None
|
||||||
|
|
||||||
def config_exits():
|
def config_exits():
|
||||||
global config
|
return get_config() is not None
|
||||||
return config is not None
|
|
||||||
|
|
||||||
def sshserver_enabled():
|
def sshserver_enabled():
|
||||||
return not is_debugging() or os.getenv("SSH_SERVER_ENABLED") == "true"
|
return not is_debugging() or os.getenv("SSH_SERVER_ENABLED") == "true"
|
||||||
|
|
||||||
def get_config():
|
def get_config():
|
||||||
global config
|
global config
|
||||||
|
if config == None:
|
||||||
|
load_config()
|
||||||
return config
|
return config
|
||||||
|
|
||||||
def load_config():
|
def load_config():
|
||||||
@@ -22,4 +23,6 @@ def load_config():
|
|||||||
if os.path.exists(file_path):
|
if os.path.exists(file_path):
|
||||||
with open(file_path, 'r') as f:
|
with open(file_path, 'r') as f:
|
||||||
config = yaml.safe_load(f)
|
config = yaml.safe_load(f)
|
||||||
|
else:
|
||||||
|
print(f"⚠️ missing " + file_path)
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ def main():
|
|||||||
else:
|
else:
|
||||||
print("👉 starting setup")
|
print("👉 starting setup")
|
||||||
|
|
||||||
|
|
||||||
globals.load_config()
|
|
||||||
setup_container()
|
setup_container()
|
||||||
|
|
||||||
if globals.is_debugging():
|
if globals.is_debugging():
|
||||||
|
|||||||
@@ -116,5 +116,4 @@ def start_server():
|
|||||||
subprocess.run(["/usr/sbin/sshd", "-D", "-e"])
|
subprocess.run(["/usr/sbin/sshd", "-D", "-e"])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
globals.load_config()
|
|
||||||
load()
|
load()
|
||||||
@@ -86,5 +86,4 @@ def load():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
globals.load_config()
|
|
||||||
load()
|
load()
|
||||||
|
|||||||
Reference in New Issue
Block a user