Skip to content

Commit fed86fd

Browse files
Merge pull request #4 from BrunoSilvaAndrade/develop
Develop
2 parents 930df98 + 3e18287 commit fed86fd

3 files changed

Lines changed: 37 additions & 5 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.idea/
2-
python_json_config_parser.egg-info/
2+
python_config_parser.egg-info/
33
venv
44
dist
55
build

README.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ MAIN FEATURES
88
* Access OOP or subscriptable, which means that you can iterate the config object items
99
* Runtime validation using [schema](https://github.com/keleshev/schema)
1010
* Automatic environment variables interpolation
11+
* Automatic parser selecting by config file extension
1112

1213
HOW TO INSTALL
1314
---------------------------
@@ -19,14 +20,22 @@ pip install python-config-parser
1920

2021
HOW TO USE
2122
---------------------------
23+
First of all the config file will look for default config files if you do not pass your own config file for this.
24+
25+
The default config directory is ./config(if you do not pass the config directory of your preference) assuming your current directory.
26+
27+
The default config files names are -> (config.json, config.yaml, config.yml)
28+
29+
30+
2231

2332
The Schema validation.
2433

25-
You may use or not schema validation, if you want to use it, it will validate your whole config object before returning it.
34+
You may use or not schema validation, if you want to use it, it will validate your whole config object before returning it.
2635

27-
If you don't want to use it, it won't validate the config object before returning that, and it may generate runtime access inconsistencies.
36+
If you don't want to use it, it won't validate the config object before returning that, and it may generate runtime access inconsistencies.
2837

29-
How to use schema
38+
How to use schema
3039

3140
```python
3241
from schema import Use, And
@@ -61,6 +70,29 @@ core:
6170
- ip: 192.168.0.11
6271
timeout: 100
6372
```
73+
This config file as a json would be something like:
74+
75+
```json
76+
{
77+
"core": {
78+
"random_env_variable": "${RANDOM_ENV_VARIABLE}",
79+
"logging": {
80+
"format": "[%(asctime)s][%(levelname)s]: %(message)s",
81+
"date_fmt": "%d-%b-%y %H:%M:%S"
82+
},
83+
"allowed_clients": [
84+
{
85+
"ip": "192.168.0.10",
86+
"timeout": 60
87+
},
88+
{
89+
"ip": "192.168.0.11",
90+
"timeout": 100
91+
}
92+
]
93+
}
94+
}
95+
```
6496

6597
The instance of Config Class:
6698
```python

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name='python-config-parser',
8-
version='2.1.0',
8+
version='2.1.1',
99
author='Bruno Silva de Andrade',
1010
author_email='brunojf.andrade@gmail.com',
1111
description='Project created to given the possibility of create dynamics config files',

0 commit comments

Comments
 (0)