Skip to main content

A zero-dependency Apollo configuration launcher for Python applications

Project description

Apollo Launcher

这是一个简单的 Python 工具,用于在应用启动前从 Apollo 配置中心拉取配置,并将其注入到环境变量中。

功能

  • 从 Apollo 拉取配置 (支持命名空间)
  • 将配置注入到环境变量
  • 启动目标应用 (使用 execvp 替换进程,保留 PID)

安装

pip install .
# 或者
pip install tec-do-apollo-env-launcher

使用方法

在启动命令前加上 apollo-launcher 即可:

# 假设原命令是 python app.py
apollo-launcher python app.py

或者使用 python -m 方式 (模块名为 apollo_launcher):

python -m apollo_launcher.main python app.py

环境变量配置

工具依赖以下环境变量:

  • APOLLO_URL: Apollo 配置中心地址 (必需)
  • APOLLO_APP_ID: 应用 ID (必需)
  • CLUSTER_NAME: 集群名称 (默认: default)
  • APOLLO_NAMESPACE: 命名空间 (默认: application)

示例

export APOLLO_URL=http://apollo-dev.example.com
export APOLLO_APP_ID=my-service
export CLUSTER_NAME=dev

apollo-launcher uvicorn main:app --host 0.0.0.0

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

tec_do_apollo_env_launcher-0.0.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tec_do_apollo_env_launcher-0.0.2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file tec_do_apollo_env_launcher-0.0.2.tar.gz.

File metadata

File hashes

Hashes for tec_do_apollo_env_launcher-0.0.2.tar.gz
Algorithm Hash digest
SHA256 240a77d77d8e5669fa1dbb8339904cb910ad4c48dfc2c18cd7e9461ae69f41cd
MD5 f50dfde89a51a1b4aaebada0d1f260f4
BLAKE2b-256 0e3743879d62d467909b335135fa245a8ddd78c4f98a4197e63f2b62442793dc

See more details on using hashes here.

File details

Details for the file tec_do_apollo_env_launcher-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for tec_do_apollo_env_launcher-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d803ef903f988a39c07ab62a7d8ccf506d363ab7607f6c1dca6d838e47d06ce7
MD5 682e0be83ce7aeb3832e8b01c3ae5620
BLAKE2b-256 a6bdf639b86887870545a870bd31f34fe33271414b487c794061d14c70427016

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page