nlsdn.config package¶
Module contents¶
-
class
nlsdn.config.
Config
(configfile=None, sections={}, order=[])[source]¶ Bases:
object
An object containing any parsed ConfigSection objects.
Each ConfigSection must stand by itself, depending on no other ConfigSections. This restriction is to allow online reconfiguration of an existing server, given that we allow some sections to prevent their reconfiguration. For instance, suppose the user edits the config file for a running server, and changes the server host/port AND adds a new static user. We want to pick up the new static user, but we will not restart the server on a new port. Thus, in that case, we need to be able to graft the old, unmodifiable sections of the old config with the modified (or modifiable) sections of the new config. Thus each config section must be independent.
-
__init__
(configfile=None, sections={}, order=[])[source]¶ Parses :param configfile:, either according to :param sections: and :param order: (although if sections is specified and order is not, order will be automatically created as sections.keys()), or to the global CONFIG_SECTIONS and CONFIG_SECTION_ORDER vars that are updated by the global_config_section decorator. The fields resulting from the parsed config are set (by section name) in this object. Any state object returned by section.apply() is stored as generic state in the server as well.
-
-
exception
nlsdn.config.
ConfigError
[source]¶ Bases:
exceptions.Exception
-
class
nlsdn.config.
ConfigSection
(configdir, jsonblob={})[source]¶ Bases:
object
A ConfigSection processes a chunk of the json config file, and is “applied” to an AuthServer instance, once parsed and validated. Usually, a ConfigSection apply() invocation would return either an Authn instance, an Authz instance, or a 2-tuple of (Authn,Authz) instances (in the case that one backend provides both authn and authz. apply() may also return None; perhaps it configures a customized Server.
-
name
= None¶ The json key for this section
-
reconfig
= False¶ True if this section supports online reconfiguration; False otherwise
-