feature/ssh-server (#1)
Co-authored-by: Márcio Fernandes <marcio.fernandes@outlook.pt> Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
28
docker/ssh-server/app/globals.py
Normal file
28
docker/ssh-server/app/globals.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import os
|
||||
import yaml
|
||||
def is_debugging(): return os.getenv("CONFIGURATION", "").lower() == "debug"
|
||||
|
||||
|
||||
file_path="/etc/app/config/config.yaml"
|
||||
config=None
|
||||
|
||||
def config_exits():
|
||||
return get_config() is not None
|
||||
|
||||
def sshserver_enabled():
|
||||
return not is_debugging() or os.getenv("SSH_SERVER_ENABLED", "false").lower() == "true"
|
||||
|
||||
def get_config():
|
||||
global config
|
||||
if config == None:
|
||||
load_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)
|
||||
else:
|
||||
print(f"⚠️ missing " + file_path)
|
||||
|
||||
Reference in New Issue
Block a user