1
Fork 0
mirror of https://github.com/Steffo99/cfig.git synced 2024-12-23 06:34:22 +00:00
cfig/README.md

36 lines
726 B
Markdown
Raw Normal View History

2022-04-19 02:16:23 +00:00
# cfig
A configuration manager for Python
2022-04-20 02:15:10 +00:00
\[ [**Example**](https://github.com/Steffo99/cfig/tree/main/cfig/sample) | [**Documentation**](https://cfig.readthedocs.io/) | [**PyPI**](https://pypi.org/project/cfig/) \]
2022-04-19 02:16:23 +00:00
```python
import cfig
config = cfig.Configuration()
@config.required()
def SECRET_KEY(val: str) -> str:
2022-04-20 02:15:10 +00:00
"""Secret string used to manage HTTP session tokens."""
2022-04-19 02:16:23 +00:00
return val
if __name__ == "__main__":
config.cli()
```
```python
from mypackage.mycfig import SECRET_KEY
2022-04-19 02:18:22 +00:00
print(f"My SECRET_KEY is: {SECRET_KEY}")
```
2022-04-19 02:16:23 +00:00
```console
$ python -m mypackage.mycfig
2022-04-20 02:15:10 +00:00
===== Configuration =====
2022-04-19 02:16:23 +00:00
SECRET_KEY → Required, but not set.
Secret string used to manage HTTP session tokens.
2022-04-20 02:15:10 +00:00
===== End =====
2022-04-19 02:16:23 +00:00
```