-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
30 lines (26 loc) · 1.18 KB
/
settings.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
"""
Contains the global settings for the application.
"""
import json
import os
BASE_DIR = os.path.dirname(__file__)
# To get the file path in base dir
def base(filename):
"""Returns the file path in base dir"""
return os.path.join(BASE_DIR, filename)
def get_env():
"""Loads the environment variables"""
environ_secrets = {}
with open(base("env.json"), encoding='utf-8') as file:
env = json.load(file)
environ_secrets["twitter_consumer_key"] = env.get("TWITTER_CONSUMER_KEY", "")
environ_secrets["twitter_consumer_secret"] = env.get("TWITTER_CONSUMER_SECRET", "")
environ_secrets["twitter_token"] = env.get("TWITTER_ACCESS_TOKEN", "")
environ_secrets["twitter_secret"] = env.get("TWITTER_ACCESS_SECRET", "")
environ_secrets["twitter_username"] = env.get("TWITTER_USERNAME", "")
environ_secrets["telegram_secret"] = env.get("TELEGRAM_SECRET", "")
environ_secrets["telegram_allowed_ids"] = env.get("TELEGRAM_ALLOWED_IDS", "")
environ_secrets["redis_host"] = env.get("REDIS_HOST", "")
environ_secrets["redis_port"] = env.get("REDIS_PORT", "")
environ_secrets["redis_password"] = env.get("REDIS_PASSWORD", "")
return environ_secrets