Commit 392863ee authored by xianyang's avatar xianyang

优化

parent addebf04
...@@ -37,11 +37,17 @@ COS_RERURN_PATH = '/images/' ...@@ -37,11 +37,17 @@ COS_RERURN_PATH = '/images/'
class Env(BaseSettings): class Env(BaseSettings):
"""基类,公共参数"""
DEBUG: bool = True DEBUG: bool = True
TESTING: bool = False TESTING: bool = False
DATABASE_URI: str = 'sqlite://:memory:' DATABASE_URI: str = 'sqlite://:memory:'
DATABASE_USER: str = '' DATABASE_USER: str = ''
DATABASE_PWD: str = '' DATABASE_PWD: str = ''
class TestingEnv(Env):
"""测试环境配置"""
TESTING: bool = True
LOG_PATH = os.path.join(SITE_ROOT_TOO, "bin", "runtime", "logs", "info", "") LOG_PATH = os.path.join(SITE_ROOT_TOO, "bin", "runtime", "logs", "info", "")
LOG_ERROR_PATH = os.path.join(SITE_ROOT_TOO, "bin", "runtime", "logs", "error", "") LOG_ERROR_PATH = os.path.join(SITE_ROOT_TOO, "bin", "runtime", "logs", "error", "")
PEM_PATH = os.path.join(SITE_ROOT_YAML, "config", "") PEM_PATH = os.path.join(SITE_ROOT_YAML, "config", "")
...@@ -49,8 +55,8 @@ class Env(BaseSettings): ...@@ -49,8 +55,8 @@ class Env(BaseSettings):
LOGIN_URL = YAML_DATA.get('login_url') LOGIN_URL = YAML_DATA.get('login_url')
NACOS_URL = YAML_DATA.get('config_url') NACOS_URL = YAML_DATA.get('config_url')
NACOSCONFIG = "show=all&dataId=fj-finance-test&group=DEFAULT_GROUP&tenant=cw-test&namespaceId=cw-test" NACOSCONFIG = "show=all&dataId=fj-finance-test&group=DEFAULT_GROUP&tenant=cw-test&namespaceId=cw-test"
NAME = "fj_finance-test" NAME = YAML_DATA.get('name')
PWD = "Fanjiao@2023" PWD = YAML_DATA.get('pwd')
DB_HISTORY = apo.get('history') DB_HISTORY = apo.get('history')
DB_3YV2 = apo.get('business') DB_3YV2 = apo.get('business')
Redis = apo.get('redis') Redis = apo.get('redis')
...@@ -61,25 +67,18 @@ class Env(BaseSettings): ...@@ -61,25 +67,18 @@ class Env(BaseSettings):
CLEARING_CENTER_URL: str = 'http://106.55.103.148:6464/' CLEARING_CENTER_URL: str = 'http://106.55.103.148:6464/'
class TestingEnv(Env): class ProdEnv(Env):
"""测试环境配置"""
TESTING: bool = True
class ProdEnv(BaseSettings):
"""生产环境配置""" """生产环境配置"""
DEBUG: bool = True
TESTING: bool = False
DATABASE_URI: str = 'sqlite://:memory:'
DATABASE_USER: str = ''
DATABASE_PWD: str = ''
LOG_PATH = os.path.join(SITE_ROOT_TOO, "bin", "runtime", "logs", "info", "") LOG_PATH = os.path.join(SITE_ROOT_TOO, "bin", "runtime", "logs", "info", "")
LOG_ERROR_PATH = os.path.join(SITE_ROOT_TOO, "bin", "runtime", "logs", "error", "") LOG_ERROR_PATH = os.path.join(SITE_ROOT_TOO, "bin", "runtime", "logs", "error", "")
PEM_PATH = os.path.join(SITE_ROOT_YAML, "config", "")
YAML_DATA = apo.get('yaml') YAML_DATA = apo.get('yaml')
LOGIN_URL = YAML_DATA.get('login_url') LOGIN_URL = YAML_DATA.get('login_url')
NACOS_URL = YAML_DATA.get('config_url') NACOS_URL = YAML_DATA.get('config_url')
NACOSCONFIG = "dataId=fj-finance&group=DEFAULT_GROUP&namespaceId=cw-pro&tenant=cw-pro&show=all&username=fj_finance" NACOSCONFIG = "dataId=fj-finance&group=DEFAULT_GROUP&namespaceId=cw-pro&tenant=cw-pro&show=all&username=fj_finance"
PEM_PATH = os.path.join(SITE_ROOT_YAML, "config", "") NAME = YAML_DATA.get('name')
PWD = YAML_DATA.get('pwd')
DB_HISTORY = apo.get('history') DB_HISTORY = apo.get('history')
DB_3YV2 = apo.get('business') DB_3YV2 = apo.get('business')
Redis = apo.get('redis') Redis = apo.get('redis')
...@@ -89,8 +88,7 @@ class ProdEnv(BaseSettings): ...@@ -89,8 +88,7 @@ class ProdEnv(BaseSettings):
CLEARING_CENTER_URL: str = 'http://47.103.144.36:5454/' CLEARING_CENTER_URL: str = 'http://47.103.144.36:5454/'
env = Env() # 开发环境 env = TestingEnv() # 测试环境
# env = TestingEnv() # 测试环境
# env = ProdEnv() # 生产环境 # env = ProdEnv() # 生产环境
redis_data = env.Redis redis_data = env.Redis
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment