-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (23 loc) · 740 Bytes
/
Copy pathmain.py
File metadata and controls
30 lines (23 loc) · 740 Bytes
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
import logging
import sys
from disturbed.configuration import Configuration, get_env
from disturbed.handler import ScheduleHandler
from disturbed.opsgenie import OpsgenieApi
from disturbed.slack import SlackApi
logger = logging.getLogger(__name__)
def main():
logging.basicConfig(
stream=sys.stdout,
level=get_env("DISTURBED_LOG_LEVEL", logging.INFO),
)
handler = ScheduleHandler(
config=Configuration(),
opsgenie_api=OpsgenieApi(api_key=get_env("DISTURBED_OPSGENIE_API_KEY")),
slack_api=SlackApi(token=get_env("DISTURBED_SLACK_API_TOKEN")),
)
error = handler.process()
if error:
logger.critical(error)
sys.exit(1)
if __name__ == "__main__":
main()