1234567891011121314151617181920212223242526272829303132 |
- from pathlib import Path
- import yaml
- __all__ = [
- 'mongo_conf',
- 'redis_conf',
- 'es_conf',
- 'jy_proxy',
- 'node_module_path',
- 'headers',
- 'analyze_url'
- ]
- _base_path = Path(__file__).parent
- _yaml_conf = (_base_path / 'conf.yaml').resolve()
- _yaml_constants = (_base_path / 'constants.yaml').resolve()
- _node_modules = (_base_path.parent / 'node_modules').resolve()
- with open(_yaml_conf, encoding="utf-8") as f:
- _conf = yaml.safe_load(f)
- mongo_conf = _conf['mongo']
- redis_conf = _conf['redis']
- es_conf: dict = _conf['es']
- jy_proxy: dict = _conf['proxy']
- node_module_path = _node_modules
- analyze_url = f'http://{es_conf["host"]}:{es_conf["port"]}/{es_conf["db"]}/_analyze'
- with open(_yaml_constants, encoding="utf-8") as fp:
- _constants = yaml.safe_load(fp)
- headers: dict = _constants['headers']
|