268 lines
6.3 KiB
Python
268 lines
6.3 KiB
Python
import sys
|
|
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 = {
|
|
'host': '139.159.159.3',
|
|
'port': 6378,
|
|
'password': 'd1Gh*zp5',
|
|
'db': 1,
|
|
'decode_responses': 'utf-8',
|
|
}
|
|
|
|
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)": 'string',
|
|
"IPv4": 'string',
|
|
|
|
"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', }
|
|
|
|
CK_OPERATOR = {
|
|
'int': [{
|
|
'id': 'sum',
|
|
'title': '总和'
|
|
}, {
|
|
'id': 'avg',
|
|
'title': '均值'
|
|
}, {
|
|
'id': 'median',
|
|
'title': '中位数'
|
|
}, {
|
|
'id': 'max',
|
|
'title': '最大值'
|
|
}, {
|
|
'id': 'min',
|
|
'title': '最小值'
|
|
}, {
|
|
'id': 'distinct_count',
|
|
'title': '去重数'
|
|
},
|
|
|
|
],
|
|
'string': [{
|
|
'id': 'distinct_count',
|
|
'title': '去重数'
|
|
}],
|
|
'float': [{
|
|
'id': 'sum',
|
|
'title': '总和'
|
|
}, {
|
|
'id': 'avg',
|
|
'title': '均值'
|
|
}, {
|
|
'id': 'median',
|
|
'title': '中位数'
|
|
}, {
|
|
'id': 'max',
|
|
'title': '最大值'
|
|
}, {
|
|
'id': 'min',
|
|
'title': '最小值'
|
|
}, {
|
|
'id': 'distinct_count',
|
|
'title': '去重数'
|
|
},
|
|
|
|
],
|
|
'array': [
|
|
{
|
|
'id': 'list_distinct',
|
|
'title': '列表去重数'
|
|
},
|
|
{
|
|
'id': 'set_distinct',
|
|
'title': '集合去重数'
|
|
},
|
|
{
|
|
'id': 'ele_distinct',
|
|
'title': '元素去重数'
|
|
},
|
|
]
|
|
}
|
|
|
|
CK_FILTER = {
|
|
'int': [{
|
|
'id': '==',
|
|
'title': '等于'
|
|
}, {
|
|
'id': '!=',
|
|
'title': '不等于'
|
|
}, {
|
|
'id': '<',
|
|
'title': '小于'
|
|
}, {
|
|
'id': '>',
|
|
'title': '大于'
|
|
}, {
|
|
'id': 'is not null',
|
|
'title': '有值'
|
|
}, {
|
|
'id': 'is null',
|
|
'title': '无值'
|
|
}, {
|
|
'id': 'range',
|
|
'title': '区间'
|
|
},
|
|
],
|
|
'string': [{
|
|
'id': '==',
|
|
'title': '等于'
|
|
}, {
|
|
'id': '!=',
|
|
'title': '不等于'
|
|
}, {
|
|
'id': 'like',
|
|
'title': '包含'
|
|
}, {
|
|
'id': 'not like',
|
|
'title': '不包含'
|
|
}, {
|
|
'id': 'is not null',
|
|
'title': '有值'
|
|
}, {
|
|
'id': 'is null',
|
|
'title': '无值'
|
|
},
|
|
# {
|
|
# 'id': 'regex',
|
|
# 'title': '正则匹配'
|
|
# }, {
|
|
# 'id': 'not regex',
|
|
# 'title': '正则不匹配'
|
|
# },
|
|
],
|
|
'float': [{
|
|
'id': '==',
|
|
'title': '等于'
|
|
}, {
|
|
'id': '!=',
|
|
'title': '不等于'
|
|
}, {
|
|
'id': '<',
|
|
'title': '小于'
|
|
}, {
|
|
'id': '>',
|
|
'title': '大于'
|
|
}, {
|
|
'id': 'is not null',
|
|
'title': '有值'
|
|
}, {
|
|
'id': 'is null',
|
|
'title': '无值'
|
|
},
|
|
# {
|
|
# 'id': 'range',
|
|
# 'title': '区间'
|
|
# },
|
|
],
|
|
'datetime': [
|
|
{
|
|
'id': '==',
|
|
'title': '绝对时间'
|
|
},
|
|
{
|
|
'id': '==',
|
|
'title': '相对当前日期'
|
|
},
|
|
{
|
|
'id': '==',
|
|
'title': '相对事件发生时刻'
|
|
},
|
|
{
|
|
'id': 'is not null',
|
|
'title': '有值'
|
|
},
|
|
{
|
|
'id': 'is null',
|
|
'title': '无值'
|
|
},
|
|
],
|
|
}
|
|
|
|
class Config:
|
|
case_sensitive = True
|
|
|
|
|
|
class Debug(Settings):
|
|
REDIS_CONF = {
|
|
'host': '139.159.159.3',
|
|
'port': 6378,
|
|
'password': 'd1Gh*zp5',
|
|
'db': 1,
|
|
'decode_responses': 'utf-8',
|
|
}
|
|
|
|
|
|
class Produce(Settings):
|
|
MDB_HOST: str = '119.29.176.224'
|
|
MDB_PORT: int = 27017
|
|
MDB_USER: str = 'root'
|
|
MDB_PASSWORD: str = 'iamciniao'
|
|
MDB_DB: str = 'xdata'
|
|
|
|
|
|
settings = Debug()
|
|
|
|
if sys.platform != 'win32':
|
|
settings = Produce()
|