Part of lp.services.config View In Hierarchy
config
module global.
Cached copies are kept in thread locals ensuring the configuration is thread safe (not that this will be a problem if we stick with simple configuration).
Method | __init__ | Create a new instance of LaunchpadConfig. |
Method | instance_name | Return the config's instance name. |
Method | config_dir | Return the directory containing this instance configuration. |
Method | setInstance | Set the instance name where the conf files are stored. |
Method | reloadConfig | Reload the config. |
Method | isTestRunner | Return true if the current config is a 'testrunner' config. |
Method | process_name | Return or set the current process's name to select a conf. |
Method | setProcess | Set the name of the process to select a conf file. |
Method | zope_config_file | Return the path to the ZConfig file for this instance. |
Method | generate_overrides | Ensure correct config.zcml overrides will be called. |
Method | appserver_root_url | Return the correct app server root url for the given facet. |
Method | __getattr__ | Undocumented |
Method | __contains__ | Undocumented |
Method | __getitem__ | Undocumented |
Method | __dir__ | List section names in addition to methods and variables. |
Method | __iter__ | Iterate through configuration sections. |
Method | _make_process_name | Undocumented |
Method | _invalidateConfig | Invalidate the config, causing the config to be regenerated. |
Method | _getConfig | Get the schema and config for this environment. |
Method | _loadConfigOverlays | Apply config overlays from the launchpad.config_overlay_dir. |
Method | _setZConfig | Modify the config, adding automatically generated settings |
Parameters | instance_name | the configuration instance to use. Defaults to the value of the LPCONFIG environment variable. |
process_name | the process configuration name to use. Defaults to the basename of sys.argv[0] without any extension, or None if sys.argv is not available. |
This normally corresponds to the LPCONFIG environment variable. It is also the name of the directory the conf file is loaded from.
This method is used to set the instance_name, which is the directory where the conf file is stored. The test runner uses this to switch on the test configuration. This method also sets the LPCONFIG environment variable so subprocesses keep the same default.
That is, if it is the testrunner config, or a unique variation of it, but not if its the testrunner-appserver, development or production config.
LaunchpadConfig loads the conf file named for the process. When the conf file does not exist, it loads launchpad-lazr.conf instead.
This method is used to set the process_name if it should be different from the name obtained from sys.argv[0]. LaunchpadConfig will try to load <process_name>-lazr.conf if it exists. Otherwise, it will load launchpad-lazr.conf.
The config is will be loaded only when there is not a config. Repeated calls to this method will not cause the config to reload.
Call this method before letting any ZCML processing occur.