-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
56 lines (49 loc) · 1.47 KB
/
config.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
from dotenv import load_dotenv
from elasticsearch import AsyncElasticsearch
from slack_bolt.async_app import AsyncApp
from slack_sdk.web.async_client import AsyncWebClient
load_dotenv()
ALLOWED_CHANNEL_ID = os.getenv("ALLOWED_CHANNEL_ID")
SLACK_USER_TOKEN = os.getenv("SLACK_USER_TOKEN")
SLACK_BOT_TOKEN = os.getenv("SLACK_BOT_TOKEN")
SLACK_APP_TOKEN = os.getenv("SLACK_APP_TOKEN")
SLACK_SIGNING_SECRET = os.getenv("SLACK_SIGNING_SECRET")
ES_HOST = os.getenv("ES_HOST")
ES_PORT = int(os.getenv("ES_PORT"))
ES_INDEX = os.getenv("ES_INDEX")
ES_USER = os.getenv("ES_USER")
ES_PASS = os.getenv("ES_PASS")
ES_API_KEY = os.getenv("ES_API_KEY")
PORT = int(os.getenv("PORT"))
# Development Elasticsearch connection
# es_dev = AsyncElasticsearch(
# hosts=[
# {
# "host": ES_HOST,
# "port": ES_PORT,
# "scheme": "https",
# }
# ],
# basic_auth=(ES_USER, ES_PASS),
# verify_certs=False,
# ssl_show_warn=False,
# )
# Production Elasticsearch connection
# TODO: Add SSL support and check in w/ Graham
es_prod = AsyncElasticsearch(
hosts=[
{
"host": ES_HOST,
"port": ES_PORT,
"scheme": "https",
}
],
api_key=ES_API_KEY,
verify_certs=False,
ssl_show_warn=False,
)
# Use es_prod for production, es_dev for development
es = es_prod
app = AsyncApp(token=SLACK_BOT_TOKEN, signing_secret=SLACK_SIGNING_SECRET)
user_client = AsyncWebClient(token=SLACK_USER_TOKEN)