Metadata-Version: 2.4
Name: spider_nacos_config
Version: 0.2.7
Summary: Unified Nacos config loader with direct exports for spider services.
Author-email: victor <xianyu.wu@innodealing.com>
License-Expression: MIT
Project-URL: Homepage, https://git.innodealing.cn/dm_spider_service/nacos_common_conf.git
Project-URL: Repository, https://git.innodealing.cn/dm_spider_service/nacos_common_conf.git
Project-URL: Issues, https://git.innodealing.cn/dm_spider_service/nacos_common_conf.git/issues
Keywords: nacos,config,settings,spider
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: nacos-sdk-python==2.0.9
Dynamic: license-file

# spider_nacos_config

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

## Install

```bash
pip install spider_nacos_config
```

## Quick Start

Direct import of config variables:

```python
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:

```python
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)

```bash
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`
