nos0s/common/config_loader.py

27 lines
449 B
Python
Raw Normal View History

2023-03-21 21:52:27 +00:00
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()