| | |
| | | import os |
| | | from pathlib import Path |
| | | import yaml |
| | | |
| | |
| | | PRIVATE_KEY: str |
| | | PASSWORD_KEY: str |
| | | basic_base_url: str = '' |
| | | basic_paper_url: str = '' |
| | | dify_base_url: str = '' |
| | | dify_api_token: str = '' |
| | | dify_workflow_clean: str = '' |
| | | dify_workflow_report: str = '' |
| | | postgresql_database_url: str = '' |
| | | dify_database_url: str = '' |
| | | def __init__(self, **kwargs): |
| | | # Check if all required fields are provided and set them |
| | | # 替换配置中的IP地址 |
| | | host_ip = kwargs.get('host_ip', '127.0.0.1') |
| | | kwargs['fwr_base_url'] = f"http://{host_ip}:11080" |
| | | kwargs['database_url'] = f"mysql+pymysql://root:infini_rag_flow@{host_ip}:5455/rag_basic" |
| | | kwargs['fwr_db_url'] = f"mysql+pymysql://root:infini_rag_flow@{host_ip}:15455/rag_flow" |
| | | kwargs['dify_base_url'] = f"http://{host_ip}:13002" |
| | | kwargs['postgresql_database_url'] = f"postgresql+asyncpg://kong:kongpass@{host_ip}:5432/kong" |
| | | kwargs['dify_database_url'] = f"postgresql+psycopg2://postgres:difyai123456@192.168.20.119:15432/dify" |
| | | for field in self.__annotations__.keys(): |
| | | if field not in kwargs: |
| | | raise ValueError(f"Missing setting: {field}") |
| | |
| | | |
| | | |
| | | # Use pathlib to handle file paths |
| | | config_yaml_path = Path(__file__).parent / 'config.yaml' |
| | | # config_yaml_path = os.path.join(os.path.join(Path(__file__).parent, "env_conf"), "config.yaml") |
| | | config_yaml_path = Path(__file__).parent.joinpath("env_conf") / 'config.yaml' |
| | | print(config_yaml_path) |
| | | settings_data = load_yaml(config_yaml_path) |
| | | |
| | | # Initialize settings object |