Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
thesimj committed Jan 8, 2019
1 parent fd581bc commit 45d2330
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Simple YAML configuration file parser with easy access for structured data

### Why
Modern configuration file become to be more complex, flexible and readable.
YAML file format are perfect to store configuration file but had no option to pass environment variables.
This project try to simplify usage YAML file and environment variables as program configuration file with easy config key access.
Modern configuration file become to be more and more complex, flexible and readable.
YAML file format are perfect to store configuration, but had no option to pass environment variables. They give flexibility, readability and provide option to store complex data structure.
This project aim to simplify usage of the YAML file and environment variables as program configuration file with easy config key access.

### Install
```bash
Expand All @@ -16,6 +16,9 @@ Let's assume we had a project with this config file `env.yaml`

```yaml
# env.yaml
project:
name: "${PROJECT_NAME}-${PROJECT_ID}"

database:
host: $DATABASE_HOST
port: 3301
Expand All @@ -38,9 +41,11 @@ redis:

and environment variables set to
```
$DATABASE_HOST=xxx.xxx.xxx.xxx
$DATABASE_PASSWORD=super-secret-password
$REDIS_PREFIX=state
PROJECT_NAME=simple-hello
PROJECT_ID=42
DATABASE_HOST=xxx.xxx.xxx.xxx
DATABASE_PASSWORD=super-secret-password
REDIS_PREFIX=state
```

parse file with `EnvYAML`
Expand All @@ -51,6 +56,11 @@ from envyaml import EnvYAML
# read file env.yaml and parse config
env = EnvYAML('env.yaml')

# access project name
print(env.project.name)

# >> simple-hello-42

# access whole database section
print(env.database)

Expand Down

0 comments on commit 45d2330

Please sign in to comment.