python apollo config
Project description
携程 Apollo(阿波罗) 配置库
说明
这是一个携程 Apollo(阿波罗) 配置获取库,支持环境变量和用户自定义配置。
配置优先级(可通过参数控制):环境变量 > 阿波罗 > 自定义
链接
安装
pip install py-apollo-config
依赖
pip install config-registry
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-1.0.0.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for py_apollo_config-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d97fac42d20f433468bbbebce952c6cf8b6a08cc5919d6aff7ab677b0349da45 |
|
MD5 | 3d60de804221c682b63912733d0990d1 |
|
BLAKE2b-256 | b85498140ad58fab8f5829af10eeb2bb12c00d356d2073718baeef352edafca1 |