2020-11-28 22:12:24 -08:00
|
|
|
from os import environ
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
|
|
|
|
|
2021-03-22 20:53:50 -07:00
|
|
|
load_dotenv()
|
2020-11-28 22:12:24 -08:00
|
|
|
|
2021-03-07 17:13:11 -08:00
|
|
|
|
|
|
|
class Config:
|
|
|
|
SECRET_KEY = environ.get("SECRET_KEY")
|
2021-03-20 13:12:33 -07:00
|
|
|
SECURITY_PASSWORD_SALT = environ.get("SECURITY_PASSWORD_SALT")
|
2021-03-07 17:13:11 -08:00
|
|
|
DB_USER = environ.get("DB_USER")
|
|
|
|
DB_PASSWORD = environ.get("DB_PASSWORD")
|
|
|
|
DB_HOST = environ.get("DB_HOST")
|
|
|
|
DB_PORT = environ.get("DB_PORT")
|
|
|
|
DB_NAME = environ.get("DB_NAME")
|
2021-03-22 16:23:52 -07:00
|
|
|
SECURITY_REGISTERABLE = True
|
2021-03-07 17:13:11 -08:00
|
|
|
|
|
|
|
|
2021-03-18 20:08:19 -07:00
|
|
|
class Production(Config):
|
2021-03-07 17:13:11 -08:00
|
|
|
FLASK_ENV = "production"
|
|
|
|
DEBUG = False
|
|
|
|
DB_SOCKET_DIR = environ.get("DB_SOCKET_DIR", "/cloudsql")
|
|
|
|
CLOUD_SQL_CONNECTION_NAME = environ.get("CLOUD_SQL_CONNECTION_NAME")
|
2021-03-27 13:55:04 -07:00
|
|
|
DB_URL = f"postgresql+psycopg2://{Config.DB_USER}:{Config.DB_PASSWORD}@{Config.DB_HOST}:{Config.DB_PORT}/{Config.DB_NAME}?host={DB_SOCKET_DIR}/{CLOUD_SQL_CONNECTION_NAME}"
|
2021-03-07 17:13:11 -08:00
|
|
|
|
|
|
|
|
2021-03-18 20:08:19 -07:00
|
|
|
class Development(Config):
|
2021-03-07 17:13:11 -08:00
|
|
|
FLASK_ENV = "development"
|
|
|
|
DEBUG = True
|
|
|
|
TESTING = True
|
2021-03-27 13:55:04 -07:00
|
|
|
DB_URL = f"postgresql+psycopg2://{Config.DB_USER}:{Config.DB_PASSWORD}@{Config.DB_HOST}:{Config.DB_PORT}/{Config.DB_NAME}"
|
2021-03-28 17:33:59 -07:00
|
|
|
|
|
|
|
|
|
|
|
class Testing(Config):
|
|
|
|
FLASK_ENV = "testing"
|
|
|
|
DEBUG = True
|
|
|
|
TESTING = True
|
|
|
|
WTF_CSRF_ENABLED = False
|
|
|
|
DB_URL = "sqlite:///test.db"
|