Skip to main content

Easy way to use existing JSON, XML or YAML config files from bash shell/scripts

Project description

Configo
=======

Easy way to use existing JSON, XML or YAML config files from bash shell/scripts

# How can i use it?
...

###Sample json config file
Lets say that this config file is located `/etc/myapp/config.json`

{
"config_version": "1.0",
"application": "My Application",
"webservers": {
"api": {
"host": "api.some.com",
"port": "80",
"apikey": "somekey",
"apisecret": "somesecret"
},

"img": {
"host": "img.some.com",
"port": "8013",
"apikey": "ihuu",
"apisecret": "somesecret"
},

"video": {
"host": "video.some.com",
"port": "80",
"apikey": "somekey",
"apisecret": "somesecret"
}
},

"databases": {
"web": { "host": "db.web.some.com", "port": "3306", "username": "myuser", "password": "mypass" },
"office": { "host": "db.office.some.com", "port": "3306", "username": "myuser", "password": "mypass" }
}
}

#Usage examples
These examples will show you several different ways about how you can work with your JSON config files in shell with ease.
All examples use the sample config file above.


### Syntax
1. `configo from config get key`
2. `configo get key` //more info below

### Shell example in standard way
# configo from /etc/myapp/config.json get application
//-> My Application

### Shell example in standard way with `nested` properties
# configo from /etc/myapp/config.json get webservers.api.host
//-> api.some.com

### Shell scripts example in standard way
TARGET_CONF="/etc/myapp/config.json";
CONFIGO="configo from $TARGET_CONF";
VARNAME=`$CONFIGO get databases.office.password`;
echo $VARNAME;
//-> mypass

### Lazy example
If you want you can assign the path to your config file to `CONFIGO_CONF` variable and `configo` will use it without having to define it as an sargument every time.

export CONFIGO_CONF=`/etc/myapp/config.json`

API_WEBSERVER_HOSTNAME=`configo get webservers.api.host`
//-> api.some.com

OFFICE_DB_HOST=`configo get databases.office.host`
//-> db.office.some.com

# Installation

from source

# git clone git@github.com:mignev/configo.git
# cd configo
# python setup.py install


with pip

# pip install configo

# TODO
- Add tests
- Add xml support
- Add yaml support


#Copyright
Copyright (c) 2012 Marian Ignev. See LICENSE for further details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Configo-1.0.tar.gz (1.9 kB view details)

Uploaded Source

Built Distribution

Configo-1.0.macosx-10.7-x86_64.tar.gz (2.9 kB view details)

Uploaded Source

File details

Details for the file Configo-1.0.tar.gz.

File metadata

  • Download URL: Configo-1.0.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Configo-1.0.tar.gz
Algorithm Hash digest
SHA256 84fa36c6ba90b3578f775c958778ccdd01fc9b389c3b03f67ba70d082298e8c6
MD5 49a358a69363e853835b7383deb52560
BLAKE2b-256 223145ba7384ed608bff89ac23d39978cc47cb9e7136c3bcd6f76cf1a28d5eaf

See more details on using hashes here.

File details

Details for the file Configo-1.0.macosx-10.7-x86_64.tar.gz.

File metadata

File hashes

Hashes for Configo-1.0.macosx-10.7-x86_64.tar.gz
Algorithm Hash digest
SHA256 eaa9bdb084293b52770a238325301ed54407c5436a93d554bb9243f5945817b1
MD5 2750a5373bfeb592709d0675c46690b7
BLAKE2b-256 190e76c645b96a96c346eca8bc6e11cdb85cfa16e70d3649cae08ac6a116e6a2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page