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
print(PUBLIC_ENV, INNO_ENV, DATA_DB_HOST)
Use the settings object:
from spider_nacos_config import nacos_settings
print(nacos_settings.PUBLIC_ENV)
print(nacos_settings.DATA_DB_HOST)
Environment Variables
Set the following before import:
NACOS_ADDRNACOS_SPIDER_ACCESS_KEYNACOS_SPIDER_SECRET_KEYNACOS_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
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spider_nacos_config-0.2.2.tar.gz.
File metadata
- Download URL: spider_nacos_config-0.2.2.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ca11fb7a2f6142cc79776075be1d70ec019d0804958b3966953a38962595380
|
|
| MD5 |
2bf8a18306049ce5026bc8e3ea6e2e62
|
|
| BLAKE2b-256 |
5297a17d882d9ca1c2be7419675764528967e8047c9b5adc2922f55cf352dead
|
File details
Details for the file spider_nacos_config-0.2.2-py3-none-any.whl.
File metadata
- Download URL: spider_nacos_config-0.2.2-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12d0f89353dad3d7d2338eaaf31d63352614ae7e4e92c0c98a9a5cef2de59608
|
|
| MD5 |
42ff033df75c4ed6d7d4a05406d86045
|
|
| BLAKE2b-256 |
7eecd28e985277b90c0918572bb691f5b01f2232956d4e7dbbdb3d0173700dbc
|