python apollo config
Project description
携程 Apollo(阿波罗) 配置库
说明
这是一个携程 Apollo(阿波罗) 配置获取库,支持环境变量和用户自定义配置。
配置优先级(可通过参数控制):环境变量 > 阿波罗 > 自定义
链接
安装
pip install py-apollo-config
依赖
pip install apollo-client
pip install py-apollo-client
使用
初始化:
import os
from ApolloClient import ApolloClient
from ApolloConfig import ApolloConfig
from ConfigRegistry import ConfigRegistry
os.environ.setdefault('ENV_PREFIX_APOLLO', 'apollo')
os.environ.setdefault('APOLLO_URI', 'http://192.168.68.251:8080')
os.environ.setdefault('APOLLO_APPID', 'equipment-services')
config = ApolloConfig(prefix='{环境变量前缀}')
#config.setting = ConfigRegistry()
#config.apollo = ApolloClient()
config.init()
获取配置:
config.get('debug', default=False, apollo=False, env=Fals)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py-apollo-config-0.0.1.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for py_apollo_config-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fa83b9d8f9bfb26d76a72a084860e075af6611d7bc9b86e1df256448575366c |
|
MD5 | 8e8c99ecfdbfd082628e0739a3669436 |
|
BLAKE2b-256 | 5e3e26297b317f2556109ce727ff068a47a996e7bc25548e3d64692738192baf |