nos0s/common/config_loader.py

27 lines
449 B
Python

import yaml
config = None
def read_config():
global config
with open ("config.yaml", "r") as conf_file:
try:
config = yaml.safe_load(conf_file)
except:
print("Error reading config")
config = None
def get_config():
global config
if config == None:
read_config()
return config
def main():
print(get_config())
read_config()
if __name__ == "__main__":
main()