Update docs for reading conf files

This patch updates the documents for how to parse configuration
files within Castellan. It is attempting to be consistent with
how other projects achieve the same thing.

Change-Id: Idd0621da37d2ea5193ee0da9e6ee81f803a005cd
This commit is contained in:
Chris Solis 2016-03-16 11:11:43 -06:00
parent abf5584dd0
commit 74a59dc501

View File

@ -270,14 +270,14 @@ Parsing the configuration files
Castellan does not parse the configuration files by default. When you create
the files and occupy them, you still need to manipulate the
``oslo_config.cfg.ConfigOpts`` object before passing it to the
``oslo_config.cfg`` object before passing it to the
``castellan.key_manager.API`` object. You can create a list of locations where
the configuration files reside. If multiple configuration files are
specified, the variables will be used from the most recently parsed file and
overwrite any previous variables. In the example below, the configuration
file in the ``/etc/castellan`` directory will overwrite the values found in
the file in the user's home directory. If a file is not found in one of the
specified locations, then a file not found error will occur.
specified locations, then a config file not found error will occur.
**Example. Parsing the config files.**
@ -286,8 +286,9 @@ specified locations, then a file not found error will occur.
from oslo_config import cfg
from castellan import key_manager
conf = cfg.ConfigOpts()
conf(['~/castellan.conf', '/etc/castellan/castellan.conf'])
conf=cfg.CONF
config_files = ['~/castellan.conf', '/etc/castellan/castellan.conf']
conf(default_config_files=config_files)
manager = key_manager.API(configuration=conf)
There are two options for parsing the Castellan values from a