Skip to main content

Unified Nacos config loader with direct exports for spider services.

Project description

spider_nacos_config

spider_nacos_config is a Python package for loading spider-related configs from Nacos and exposing them as Python variables.

Install

pip install spider_nacos_config

Quick Start

Direct import of config variables:

from spider_nacos_config import PUBLIC_ENV, INNO_ENV, DATA_DB_HOST, POLAR_GENERAL_DB_HOST

print(PUBLIC_ENV, INNO_ENV, DATA_DB_HOST, POLAR_GENERAL_DB_HOST)

Use the settings object:

from spider_nacos_config import nacos_settings

print(nacos_settings.PUBLIC_ENV)
print(nacos_settings.DATA_DB_HOST)
print(nacos_settings.POLAR_GENERAL_DB_HOST)

Environment Variables

Set the following before import:

  • NACOS_ADDR
  • NACOS_SPIDER_ACCESS_KEY
  • NACOS_SPIDER_SECRET_KEY
  • NACOS_NAMESPACE (optional, default: qa)
  • NACOS_SPIDER_NAMESPACE (optional, default: qa-spider)

Add New Config Mapping

To add a new mysql/redis/rabbitmq config, update spider_nacos_config/base_config.py in NACOS_CONFIG_MAP.

For mysql entries, if the name follows *_mysql, mount prefix can be inferred automatically.

Build And Upload (PyPI)

python -m pip install --upgrade build twine
python -m build
python -m twine check dist/*
python -m twine upload dist/*

Version

Current package version: 0.2.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

spider_nacos_config-0.2.7.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

spider_nacos_config-0.2.7-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file spider_nacos_config-0.2.7.tar.gz.

File metadata

  • Download URL: spider_nacos_config-0.2.7.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for spider_nacos_config-0.2.7.tar.gz
Algorithm Hash digest
SHA256 36f7dd09f785bcc29a79b9b1dc3e6a8f434facf74d10c6d3283b60d7874322b0
MD5 5378dbaf55049c425ef8ffe8b2c65b63
BLAKE2b-256 8ced8632c6db15d50b368275d855e3a39a9ecaa10899e86d31a1744f48dd2487

See more details on using hashes here.

File details

Details for the file spider_nacos_config-0.2.7-py3-none-any.whl.

File metadata

File hashes

Hashes for spider_nacos_config-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 dfca97bf36fae60359bf1a53a70718fb0beffcb288d21c19dc94c3e442f08fbb
MD5 96cec110b06deb093ba6883cd83b8d2f
BLAKE2b-256 d53dcfebe2faf56ebb30a0185d3e3ac8247ce6eca4d7ac4f43e8a7516ae63b99

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