-
Notifications
You must be signed in to change notification settings - Fork 3
/
config.py
54 lines (39 loc) · 1.71 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
51
52
53
54
# -*- coding: utf-8 -*-
import os
basedir = os.path.abspath(os.path.dirname(__file__))
DEFAULT_AIPSCAN_DB = "sqlite:///" + os.path.join(basedir, "aipscan.db")
DEFAULT_CELERY_DB = "sqlite:///" + os.path.join(basedir, "celerytasks.db")
DEFAULT_TYPESENSE_HOST = "localhost"
DEFAULT_TYPESENSE_PORT = "8108"
DEFAULT_TYPESENSE_API_KEY = None
DEFAULT_TYPESENSE_PROTOCOL = "http"
DEFAULT_TYPESENSE_TIMEOUT_SECONDS = "30"
DEFAULT_TYPESENSE_COLLECTION_PREFIX = "aipscan_"
class Config:
# Be sure to set a secure secret key for production.
SECRET_KEY = os.getenv("SECRET_KEY", "you-will-never-guess")
DEBUG = False
TESTING = False
SQLALCHEMY_DATABASE_URI = os.getenv("SQLALCHEMY_DATABASE_URI", DEFAULT_AIPSCAN_DB)
SQLALCHEMY_CELERY_BACKEND = os.getenv(
"SQLALCHEMY_CELERY_BACKEND", DEFAULT_CELERY_DB
)
SQLALCHEMY_BINDS = {"celery": SQLALCHEMY_CELERY_BACKEND}
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_ECHO = False
TYPESENSE_HOST = os.getenv("TYPESENSE_HOST", DEFAULT_TYPESENSE_HOST)
TYPESENSE_PORT = os.getenv("TYPESENSE_PORT", DEFAULT_TYPESENSE_PORT)
TYPESENSE_API_KEY = os.getenv("TYPESENSE_API_KEY", DEFAULT_TYPESENSE_API_KEY)
TYPESENSE_PROTOCOL = os.getenv("TYPESENSE_PROTOCOL", DEFAULT_TYPESENSE_PROTOCOL)
TYPESENSE_TIMEOUT_SECONDS = os.getenv(
"TYPESENSE_TIMEOUT_SECONDS", DEFAULT_TYPESENSE_TIMEOUT_SECONDS
)
TYPESENSE_COLLECTION_PREFIX = os.getenv(
"TYPESENSE_COLLECTION_PREFIX", DEFAULT_TYPESENSE_COLLECTION_PREFIX
)
class DevelopmentConfig(Config):
DEBUG = True
class TestConfig(Config):
TESTING = True
SQLALCHEMY_DATABASE_URI = "sqlite:///:memory:"
CONFIGS = {"dev": DevelopmentConfig, "test": TestConfig, "default": Config}