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
8 years ago
269 | 269 | |
270 | 270 | Castellan does not parse the configuration files by default. When you create |
271 | 271 | 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 | |
273 | 273 | ``castellan.key_manager.API`` object. You can create a list of locations where |
274 | 274 | the configuration files reside. If multiple configuration files are |
275 | 275 | specified, the variables will be used from the most recently parsed file and |
276 | 276 | overwrite any previous variables. In the example below, the configuration |
277 | 277 | file in the ``/etc/castellan`` directory will overwrite the values found in |
278 | 278 | 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. | |
280 | 280 | |
281 | 281 | **Example. Parsing the config files.** |
282 | 282 | |
285 | 285 | from oslo_config import cfg |
286 | 286 | from castellan import key_manager |
287 | 287 | |
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) | |
290 | 291 | manager = key_manager.API(configuration=conf) |
291 | 292 | |
292 | 293 | There are two options for parsing the Castellan values from a |