config – Configuration backend.
Platform can be configured via ini files. For ease of administration,
platform can also be configured via web as well, where the configuration
information (basically the key, value pair) will be persisted by a backend
store like sqlite3.
Note that configuration parameters from database backend will override
default_settings and configurations from ini file.
Module contents
-
class pluggdapps.config.ConfigSqlite3DB(pa, *args, **kwargs)[source]
Bases: pluggdapps.plugin.Plugin
Backend interface to persist configuration information in sqlite3
database.
Settings are stored in tables, one table for each mounted application.
netpath name (contains subdomain-hostname / script), on which
application is mounted, will be used as table-name. Table structure,
<netpath> table :
section |
settings |
section-name |
JSON string of settings |
where,
- section-name can be special section or plugin section that starts with
plugin: prefix.
- JSON string contains key,value pairs of configuration settings only for
those parameters that were updated using web-frontend.
- along with netpaths, a special table called platform will be created.
Platform wide settings, overriden by settings from master-ini file, will
be stored in this table.
- special sections will be present only in case of platform table.
For other netpath tables, other that [DEFAULT] section, no special
section will be stored.
-
connect(*args, **kwargs)[source]
pluggdapps.interfaces.IConfigDB.connect() interface method.
-
dbinit(netpaths=[])[source]
pluggdapps.interfaces.IConfigDB.dbinit() interface method.
Optional key-word argument,
- netpaths,
- list of web-application mount points. A database table will be
created for each netpath.
-
config(**kwargs)[source]
pluggdapps.interfaces.IConfigDB.config() interface method.
Keyword arguments,
- netpath,
- Netpath, including subdomain-hostname and script-path, on which
web-application is mounted. Optional.
- section,
- Section name to get or set config parameter. Optional.
- name,
- Configuration name to get or set for section. Optional.
- value,
- If present, this method was invoked for setting configuration
name under section. Optional.
- if netpath, section, name and value kwargs are supplied, will update
config-parameter name under webapp’s section with value.
Return the updated value.
- if netpath, section, name kwargs are supplied, will return
configuration value for name under webapp’s section.
- if netpath, section kwargs are supplied, will return dictionary of
all configuration parameters under webapp’s section.
- if netpath is supplied, will return the entire table as dictionary
of sections and settings.
- if netpath is not supplied, will use section, name and value
arguments in the context of platform table.
-
close()[source]
pluggdapps.interfaces.IConfigDB.close() interface method.