Skip to main content

Use configtool from the shell to validate, pretty-print, get or set config values::

Project description

Use configtool from the shell to validate, pretty-print, get or set config values::

With no arguments you will output the same config file, you can use this feature
to validate the file.

$ config.ini > python -m configtool
[app]
name = rocket
description = A app to launch a Space Rocket
[uwsgi]
socket = /var/run/spacerocket.socket

-get argument will print the value of the key on the section you want, you can
also do -section and -get will use that for section.

$ cat config.ini | python -m configtool -get app.name
rocket
$ cat config.ini | python -m configtool -section app -get description
A app to launch a Space Rocket

Specify just the section, and it will output the config syntax for just that
section

$ cat config.ini | python -m configtool -get app
[app]
name = rocket
description = A app to launch a Space Rocket

Easily update values, just by using set

$ python -m configtool -set app.name "spacerocket" > config.ini
$ cat config.ini
[app]
name = spacerocket
description = A app to launch a Space Rocket

You can also convert syntax if you had json or yaml python modules available::

$ cat config.ini | python -m configtool -o yaml
app:
name: spacerocket
description: A app to launch a Space Rocket

$ config.ini > python -m configtool -o json
{"app":{"name":"spacerocket","description":"A app to launch a Space Rocket"}}

Project details


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