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
Built Distribution
File details
Details for the file py-apollo-config-1.1.2.tar.gz
.
File metadata
- Download URL: py-apollo-config-1.1.2.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.7.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0805b182c58daf90968e87da9893ce5ef132dc30e250f7fb8f686c183593d2a1 |
|
MD5 | a4987666c7b1c2ce20bb0f4dd926d8e0 |
|
BLAKE2b-256 | 7c1aaef943c90dac1e78c4461cf9111aac2afc141064e47150c96f2c1d56fbda |
File details
Details for the file py_apollo_config-1.1.2-py3-none-any.whl
.
File metadata
- Download URL: py_apollo_config-1.1.2-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.7.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f2db13931a183fa7ba469e5b307825f27ee474d6101dd60ab7644aefdaa453a |
|
MD5 | c5794a4101bafa25a87fe70f743ee024 |
|
BLAKE2b-256 | 24a38f2f68422cad3351b82f5a05b6aa31f0f3370d3b3a7e2dcca236f82c0faa |