alertmanager-bark-hook/app/app.py

24 lines
541 B
Python
Raw Normal View History

2022-08-08 05:51:01 +00:00
import yaml
from flask import Flask
from utils.json_encoder import JSONEncoder
from os.path import dirname, abspath, join
class Config():
pass
with open('config/config.yaml', 'r') as f:
config_yaml = yaml.safe_load(f)
config = Config()
for k, v in config_yaml.items():
setattr(config, k, v)
app = Flask(__name__,
2022-08-15 05:51:23 +00:00
root_path=join(dirname(abspath(__file__)), '..'), template_folder="config")
2022-08-08 05:51:01 +00:00
app.config.from_object(config)
app.json_encoder = JSONEncoder
app.config['RESTFUL_JSON'] = {
'cls': app.json_encoder
}