-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconf.py
53 lines (49 loc) · 1.68 KB
/
conf.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
import os
import json
try:
from dotenv import load_dotenv
load_dotenv()
except ModuleNotFoundError:
pass
config = {
"password": os.getenv("PASSWORD"),
"log_handler": {
"log_dir": os.getenv("LOG_HANDLER_LOG_DIR"),
},
"cors": {
"origins": os.getenv("CORS_ORIGINS"),
},
"db_handler": {
"mongo_host": os.getenv("DB_HANDLER_MONGO_HOST"),
"mongo_port": int(os.getenv("DB_HANDLER_MONGO_PORT")),
"mongo_db_name": os.getenv("DB_HANDLER_MONGO_DB_NAME"),
"mongo_article_collection_name": os.getenv(
"DB_HANDLER_MONGO_ARTICLE_COLLECTION_NAME"
),
"mongo_tweet_collection_name": os.getenv(
"DB_HANDLER_MONGO_TWEET_COLLECTION_NAME"
),
"es_host": os.getenv("DB_HANDLER_ES_HOST"),
"es_port": int(os.getenv("DB_HANDLER_ES_PORT")),
},
"twitter_handler": {
"token": os.getenv("TWITTER_HANDLER_OAUTH_TOKEN"),
"token_secret": os.getenv("TWITTER_HANDLER_OAUTH_TOKEN_SECRET"),
"consumer_key": os.getenv("TWITTER_HANDLER_OAUTH_CONSUMER_KEY"),
"consumer_secret": os.getenv("TWITTER_HANDLER_OAUTH_CONSUMER_SECRET"),
},
"slack_handlers": [
{"access_token": access_token, "app_channel": app_channel}
for access_token, app_channel in zip(
os.getenv("SLACK_HANDLER_ACCESS_TOKENS").split(),
os.getenv("SLACK_HANDLER_APP_CHANNELS").split(),
)
],
"data": {
"article_list": os.getenv("ARTICLE_LIST"),
"tweet_list": os.getenv("TWEET_LIST"),
"site_list": os.getenv("SITE_LIST"),
},
}
with open("config.json", "w") as f:
json.dump(config, f, ensure_ascii=False, indent=4)