xbackend/core/config.py
2021-05-20 10:10:07 +08:00

90 lines
2.3 KiB
Python

from typing import Any, Dict, List, Optional, Union
from pydantic import AnyHttpUrl, BaseSettings, EmailStr, HttpUrl, validator
class Settings(BaseSettings):
PROJECT_NAME: str = 'X数据分析后台'
API_V1_STR: str = '/api/v1'
BACKEND_CORS_ORIGINS: List[str] = ['*']
MDB_HOST: str = '10.0.0.7'
MDB_PORT: int = 27017
MDB_USER: str = 'root'
MDB_PASSWORD: str = 'iamciniao'
MDB_DB: str = 'xdata'
CASBIN_COLL: str = 'casbin_rule'
DATABASE_URI = f'mongodb://{MDB_USER}:{MDB_PASSWORD}@{MDB_HOST}:{MDB_PORT}/admin'
SUPERUSER_EMAIL: str = '15392746632@qq.com'
SUPERUSER_PASSWORD: str = '123456'
SUPERUSER_NAME: str = 'root'
SUPERUSER_NICKNAME: str = 'root'
DEFAULT_PASSWORD = '123456'
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 8
SECRET_KEY: str = 'ZaFX6EypK6PtuhGv11q4DLRvAb0csiLx4dbKUwLwCe8'
REDIS_CONF = {
'address': ('192.168.0.161', 6379),
'password': 'd1Gh*zp5',
'db': 1, # 存表结构
}
CK_CONFIG = {'host': '119.29.176.224',
'send_receive_timeout': 30}
CK_TYPE_DICT = {"DateTime('UTC')": 'datetime',
"Nullable(DateTime('UTC'))": 'datetime',
"DateTime()": 'datetime',
"Nullable(IPv4)": 'ip',
"IPv4": 'ip',
"String": 'string',
"Nullable(String)": 'string',
"Nullable(UInt8)": 'int',
"UInt8": 'string',
"Nullable(Int8)": 'int',
"Int8": 'string',
"Nullable(UInt16)": 'int',
"UInt16": 'string',
"Nullable(Int16)": 'int',
"Int16": 'string',
"Nullable(UInt32)": 'int',
"UInt32": 'string',
"Nullable(UInt64)": 'int',
"UInt64": 'string',
"Nullable(Int64)": 'int',
"Int64": 'string',
"Array(String)": 'array',
"Nullable(Float)": 'float',
"Float": 'float', }
class Config:
case_sensitive = True
class Debug(Settings):
REDIS_CONF = {
'address': ('139.159.159.3', 6378),
'password': 'd1Gh*zp5',
'db': 1
}
settings = Debug()