Skip to content
/ varust Public

A simple CLI tool to expand environment variables from yaml file

License

Notifications You must be signed in to change notification settings

quiye/varust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Varust

A simple CLI tool to extract environment variables from yaml file.

Installing

cargo install --git https://github.com/quiye/varust.git

Usage

sample.yaml is a simple structured yaml file.

$ cat sample.yaml
# shared variables
shared:
  environment:
    REPLICATION: 3
    CONSISTENCY: ONE
# variables for production
prod:
  environment:
    URL: https://prod-env.com
    PORT: 443
    REPLICATION: 5
    CONSISTENCY: ALL
# variables for develop
dev:
  environment:
    URL: http://dev-env.com
    PORT: 80
    CONSISTENCY: TWO

From above file, we can extract productional environment variables by varust.

$ varust prod.environment sample.yaml
REPLICATION=5
CONSISTENCY=ALL
URL=https://prod-env.com
PORT=443

On the other hand, we can extract variables for develop environment.

$ varust dev.environment sample.yaml
PORT=80
URL=http://dev-env.com
CONSISTENCY=TWO

Options

-o (--on)

By using this option, we can expand dev.environment on a shared setting shared.environment.

Look below !

$ varust dev.environment --on shared.environment sample.yaml
PORT=80
REPLICATION=3
CONSISTENCY=TWO
URL=http://dev-env.com