This commit is contained in:
25
docker/ssh-server/app/globals.py
Normal file
25
docker/ssh-server/app/globals.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import os
|
||||
import yaml
|
||||
def is_debugging(): return os.getenv("CONFIGURATION") == "Debug"
|
||||
|
||||
|
||||
file_path="/etc/app/config.yaml"
|
||||
config=None
|
||||
|
||||
def config_exits():
|
||||
global config
|
||||
return config is not None
|
||||
|
||||
def sshserver_enabled():
|
||||
return not is_debugging() or os.getenv("SSH_SERVER_ENABLED") == "true"
|
||||
|
||||
def get_config():
|
||||
global config
|
||||
return config
|
||||
|
||||
def load_config():
|
||||
global config
|
||||
if os.path.exists(file_path):
|
||||
with open(file_path, 'r') as f:
|
||||
config = yaml.safe_load(f)
|
||||
|
||||
Reference in New Issue
Block a user