jip.configuration

Manage the JIP configuration.

The JIP command line tools and the JIP API load it’s default configuration from disk. Three locations are checked by default for jip.json file. The folder that contains the jip executable, the JIP_CONFIG environment variable, and the current users $HOME directory. If exists, the configuration next to the jip executable is loaded first and the users configuration can extend it.

An instance of the loaded configuration is exposed in the jip main module:

>>> import jip
>>> assert jip.config is not None

The Config object provides general accessors in a dictionary fashion to the jip configuration by also allows dotted access:

>>> import jip
>>> assert jip.config['jip_path'] == jip.config.jip_path
class jip.configuration.Config(_config=None)

Wrapper around the JIP configuration that allows dotted access to the configuration. Please note that the dotted access works if you request it as a single key:

>>> c = Config()
>>> print c['profiles.default']
{}

But it will not work recursively through all attribute ( c.profiles.default will raise an exception)

get(name, default=None)

Get a value from the configuration

Parameters:
  • name – the key name
  • default – default value returned if value does not exist
Returns:

value in configuration or default value

Fork me on GitHub