Initial commit

This commit is contained in:
Benjamin Collet 2025-01-07 09:50:19 +01:00
commit 6c02075a57
Signed by: bcollet
SSH key fingerprint: SHA256:8UJspOIcCOS+MtSOcnuq2HjKFube4ox1s/+A62ixov4
5 changed files with 574 additions and 0 deletions
models

25
models/config.py Normal file
View file

@ -0,0 +1,25 @@
import os
import sys
import yaml
class config:
@classmethod
def __init__(self):
for config_path in (
os.path.expanduser("~/.config/step-ca-inspector"),
os.environ.get("STEP_CA_INSPECTOR_CONF"),
):
if config_path is None:
continue
try:
with open(os.path.join(config_path, "config.yaml")) as ymlfile:
cfg = yaml.load(ymlfile, Loader=yaml.FullLoader)
break
except IOError:
pass
else:
print("No configuration file found")
sys.exit(1)
for k, v in cfg.items():
setattr(self, k, v)