Skip to main content

携程 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)

Metadata

Release files for py-apollo-config 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-apollo-config 1.1.2
File Size Uploaded
py-apollo-config-1.1.2.tar.gz 3.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-apollo-config 1.1.2
File Interpreter ABI Platform
py_apollo_config-1.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 6.8 kB

Release files / py-apollo-config-1.1.2.tar.gz

Download URL py-apollo-config-1.1.2.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0805b182c58daf90968e87da9893ce5ef132dc30e250f7fb8f686c183593d2a1
BLAKE2b-256 checksum
How to use checksums
7c1aaef943c90dac1e78c4461cf9111aac2afc141064e47150c96f2c1d56fbda
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / py_apollo_config-1.1.2-py3-none-any.whl

Download URL py_apollo_config-1.1.2-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f2db13931a183fa7ba469e5b307825f27ee474d6101dd60ab7644aefdaa453a
BLAKE2b-256 checksum
How to use checksums
24a38f2f68422cad3351b82f5a05b6aa31f0f3370d3b3a7e2dcca236f82c0faa
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

1.1.1

2 release files

1.0.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page