Codebase list python-castellan / 74a59dc
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 Chris Solis 7 years ago
1 changed file(s) with 5 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
270270 Castellan does not parse the configuration files by default. When you create
271271 the files and occupy them, you still need to manipulate the
272 ``oslo_config.cfg.ConfigOpts`` object before passing it to the
272 ``oslo_config.cfg`` object before passing it to the
273273 ``castellan.key_manager.API`` object. You can create a list of locations where
274274 the configuration files reside. If multiple configuration files are
275275 specified, the variables will be used from the most recently parsed file and
276276 overwrite any previous variables. In the example below, the configuration
277277 file in the ``/etc/castellan`` directory will overwrite the values found in
278278 the file in the user's home directory. If a file is not found in one of the
279 specified locations, then a file not found error will occur.
279 specified locations, then a config file not found error will occur.
281281 **Example. Parsing the config files.**
285285 from oslo_config import cfg
286286 from castellan import key_manager
288 conf = cfg.ConfigOpts()
289 conf(['~/castellan.conf', '/etc/castellan/castellan.conf'])
288 conf=cfg.CONF
289 config_files = ['~/castellan.conf', '/etc/castellan/castellan.conf']
290 conf(default_config_files=config_files)
290291 manager = key_manager.API(configuration=conf)
292293 There are two options for parsing the Castellan values from a