envawareconfig-0.2.1
توضیحات
Load configurations from yaml files with automatic environment variable substitution
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | envawareconfig-0.2.1 |
| نام | envawareconfig |
| نسخه کتابخانه | 0.2.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | marcello |
| ایمیل نویسنده | marcello.frattini7@gmail.com |
| آدرس صفحه اصلی | https://github.com/mfrattini7/envawareconfig |
| آدرس اینترنتی | https://pypi.org/project/envawareconfig/ |
| مجوز | - |
# Envawareconfig
Load configurations from yaml files with automatic environment variable substitution.
## Installation
with [pip](https://pip.pypa.io/en/stable/):
`pip install envawareconfig`
with [poetry](https://python-poetry.org/):
`poetry add envawareconfig`
## QuickStart
Suppose you have a configuration file like this:
```yaml
# test-config.yaml
database:
name: my-database
user: "${DB_USER:admin}"
password: "${DB_PASSWORD}"
```
and that you have set the environment variable `DB_PASSWORD` to `my-secret-password`
while `DB_USER` has been left unset.
then running the following code:
```python
# main.py
from envawareconfig import load_config
config = load_config("tests/test-config.yaml")
```
would result in:
```python
config = {
"database": {
"name": "my-database",
"user": "admin",
"password": "my-secret-password"
}
}
```
Notice that `${DB_PASSWORD}` has been expanded and `${DB_USER:admin}` used the default value.
نیازمندی
| مقدار | نام |
|---|---|
| >=6.0,<7.0 | PyYAML |
| >=0.19.2,<0.20.0 | python-dotenv |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.9,<4.0 | Python |
نحوه نصب
نصب پکیج whl envawareconfig-0.2.1:
pip install envawareconfig-0.2.1.whl
نصب پکیج tar.gz envawareconfig-0.2.1:
pip install envawareconfig-0.2.1.tar.gz