-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
39 lines (31 loc) · 1.07 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""
Main entry point for the application. This file is responsible for setting up the
"""
import os
import yaml
from flask import Flask
from ec2_slackbot.aws_handler import AWSHandler
from ec2_slackbot.instance_checker import InstanceChecker
from ec2_slackbot.slack_handler import SlackHandler
from ec2_slackbot.web_server import WebServer
app = Flask(__name__)
def main():
"""
Main entry point for the application.
"""
config = yaml.safe_load(open("config.yaml", "r", encoding="utf-8"))
aws_handler = AWSHandler(config=config)
slack_handler = SlackHandler(
config=config,
aws_handler=aws_handler,
token=os.environ["SLACK_BOT_TOKEN"],
signing_secret=os.environ["SLACK_SIGNING_SECRET"],
)
web_server = WebServer(config=config, slack_handler=slack_handler)
periodic_checker = InstanceChecker(
config=config, slack_handler=slack_handler, aws_handler=aws_handler
)
periodic_checker.start_periodic_checks(interval=config["check_interval_seconds"])
web_server.run()
if __name__ == "__main__":
main()