2021-05-29 18:22:51 +02:00
|
|
|
# -*- coding: UTF-8 -*
|
|
|
|
|
|
|
|
import os
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
|
|
|
|
BASEDIR = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
load_dotenv(os.path.join(BASEDIR, ".env"))
|
|
|
|
|
|
|
|
|
2021-07-20 17:32:04 +02:00
|
|
|
class Config:
|
2021-05-31 00:14:15 +02:00
|
|
|
"""General configuration. Mostly loaded from environment via .env"""
|
2021-05-29 18:22:51 +02:00
|
|
|
|
|
|
|
SECRET_KEY = os.environ.get("SECRET_KEY") or "un-grand-secret-introuvable"
|
|
|
|
SQLALCHEMY_DATABASE_URI = (
|
2021-05-31 00:14:15 +02:00
|
|
|
os.environ.get("USERS_DATABASE_URI")
|
|
|
|
or "postgresql://scodoc@localhost:5432/SCO8USERS"
|
2021-05-29 18:22:51 +02:00
|
|
|
)
|
|
|
|
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
|
|
|
LOG_TO_STDOUT = os.environ.get("LOG_TO_STDOUT")
|
|
|
|
MAIL_SERVER = os.environ.get("MAIL_SERVER")
|
|
|
|
MAIL_PORT = int(os.environ.get("MAIL_PORT") or 25)
|
|
|
|
MAIL_USE_TLS = os.environ.get("MAIL_USE_TLS") is not None
|
|
|
|
MAIL_USERNAME = os.environ.get("MAIL_USERNAME")
|
|
|
|
MAIL_PASSWORD = os.environ.get("MAIL_PASSWORD")
|
|
|
|
LANGUAGES = ["fr", "en"] # unused for now
|
|
|
|
SCODOC_ADMIN_MAIL = os.environ.get("SCODOC_ADMIN_MAIL")
|
|
|
|
SCODOC_ADMIN_LOGIN = os.environ.get("SCODOC_ADMIN_LOGIN") or "admin"
|
|
|
|
ADMINS = [SCODOC_ADMIN_MAIL]
|
|
|
|
SCODOC_ERR_MAIL = os.environ.get("SCODOC_ERR_MAIL")
|
|
|
|
BOOTSTRAP_SERVE_LOCAL = os.environ.get("BOOTSTRAP_SERVE_LOCAL")
|
2021-07-25 09:51:09 +02:00
|
|
|
SCODOC_DIR = os.environ.get("SCODOC_DIR", "/opt/scodoc")
|
|
|
|
SCODOC_VAR_DIR = os.environ.get("SCODOC_VAR_DIR", "/opt/scodoc-data")
|
2021-05-31 00:14:15 +02:00
|
|
|
|
|
|
|
# For legacy ScoDoc7 installs: postgresql user
|
|
|
|
SCODOC7_SQL_USER = os.environ.get("SCODOC7_SQL_USER", "www-data")
|
|
|
|
DEFAULT_SQL_PORT = os.environ.get("DEFAULT_SQL_PORT", "5432")
|
2021-06-16 16:59:31 +02:00
|
|
|
# STATIC_URL_PATH = "/ScoDoc/static"
|
|
|
|
# static_folder = "stat"
|
|
|
|
# SERVER_NAME = os.environ.get("SERVER_NAME")
|
2021-08-09 23:23:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
class ProdConfig(Config):
|
|
|
|
FLASK_ENV = "production"
|
|
|
|
DEBUG = False
|
|
|
|
TESTING = False
|
|
|
|
SQLALCHEMY_DATABASE_URI = (
|
|
|
|
os.environ.get("SCODOC_DATABASE_URI") or "postgresql:///SCODOC"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class DevConfig(Config):
|
|
|
|
FLASK_ENV = "development"
|
|
|
|
DEBUG = True
|
|
|
|
TESTING = True
|
|
|
|
SQLALCHEMY_DATABASE_URI = (
|
|
|
|
os.environ.get("SCODOC_DEV_DATABASE_URI") or "postgresql:///SCODOC_DEV"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class TestConfig(DevConfig):
|
|
|
|
SQLALCHEMY_DATABASE_URI = (
|
|
|
|
os.environ.get("SCODOC_TEST_DATABASE_URI") or "postgresql:///SCODOC_TEST"
|
|
|
|
)
|
|
|
|
SERVER_NAME = "test.gr"
|