-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.py
50 lines (39 loc) · 1.43 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
"""Flask configuration."""
import os
from urllib.parse import quote
FLASK_ENV = os.environ.get("FLASK_ENV", "development")
if FLASK_ENV == "development":
from os import path
from dotenv import load_dotenv
basedir = path.abspath(path.dirname(__file__))
load_dotenv(path.join(basedir, ".env"))
TESTING = os.environ.get("TESTING")
DEBUG = os.environ.get("DEBUG")
quoted_password = quote(os.environ.get("DB_PASSWORD"))
# Database configuration
POSTGRES = {
"user": os.environ.get("DB_USER"),
"password": quoted_password,
"database": os.environ.get("DB_NAME"),
"host": os.environ.get("DB_HOST"),
"port": os.environ.get("DB_PORT"),
"connection_name": os.environ.get("CONNECTION_NAME"),
}
SQLALCHEMY_DATABASE_URI = (
"postgresql://%(user)s:%(password)s@%(host)s:%(port)s/%(database)s" % POSTGRES
)
# For socket based connection
if FLASK_ENV == "staging":
SQLALCHEMY_DATABASE_URI = (
"postgresql://%(user)s:%(password)s@/%(database)s?host=%(connection_name)s/"
% POSTGRES
)
WTF_CSRF_ENABLED = True
SECRET_KEY = os.environ.get("SECRET_KEY")
DEFAULT_PROGRAM_ID = 2
DEFAULT_PROGRAM_TIME_CATEGORY = "AFTERNOON"
RETRY_LOGS_BATCH_LIMIT = os.environ.get("RETRY_LOGS_BATCH_LIMIT", 1000)
TELCO_CODE_ANSWERED = 16
DEFAULT_LANGUAGE_ID = 1
MAX_RETRY_ATTEMPTS_FOR_LOGS = os.environ.get("MAX_RETRY_ATTEMPTS_FOR_LOGS", 3)
GOOGLE_APPLICATION_CREDENTIALS = os.environ.get("GOOGLE_APPLICATION_CREDENTIALS")