Configuring pluggdapps ====================== Another fundamental aspect of software systems is to provide a way to configure and customize them. Pluggdapps provide a wonderful configuration system. It is the responsibility of platform to gather configuration settings from various sources (like ini-files, data-base etc..) and make them available for plugins. So how are these configuration settings related to a plugin ? Well, a plugin is nothing but a dictionary like object, whose (key,value) pairs are nothing but its configuration settings. If settings for a plugin is changed in the ini-file or in the data-base, it is automatically made available as a key,value inside the plugin. For example, :class:`pluggdapps.web.server.HTTPEPollServer` plugin has configurable parameters like, `host`, `port`, `backlog` etc ... the settings are configured in the ini-file like, .. code-block:: ini :linenos: [plugin:HTTPEPollServer] host = mysite.com port = 80 backlog = 10 these settings are automatically made available inside the plugin (plugin is refered by ``self``) logic like, .. code-block:: python :linenos: class HTTPEPollServer( Pluing ): ... def bind( args, kwargs ) : ... sock.listen( self['backlog'] ) print( "Listening host and port, " % (self['host'], self['port']) ) ... ... From administrator's point of view, platform configuration can be done via ini file(s) or through browser using pre-packaged application ``webadmin``, which is mounted on the url like `http://:/webadmin`. Master configuration file ------------------------- Pluggdapps is typically launched using a master configuration file. For instance, the following command provides a way to start the pluggdapps server with -c switch supplying master configuration file. .. code-block:: bash :linenos: $ pa-env/bin/pa -w -c etc/master.ini serve master configuration file is expected to provide configuration parameters organized under two types of sections, ``special-section`` and ``plugin-section``. **[DEFAULT] special section** The semantics of DEFAULT section is same as defined by ``configparser`` from python standard library. In short, the configured names and their corresponding values will be applicable to every other section defined in the configuration file and all the other configuration files refered by the master configuration file. **[pluggdapps] special section** Platform related configuration is expected to go under this section. **[mountloc] special section** This section is defined by ``Webapps`` platform. While using ``Pluggdapps`` platform this section is not supported. Administrators can mount web application instances on subdomains and script-paths. For Eg, .. code-block:: ini :linenos: [mountloc] pluggdapps.com/webadmin = pluggdapps.webadmin, %(here)s/webadmin.ini tayra.pluggdapps.com/ = pluggdapps.docroot, %(here)s/tayra.ini The configuration name under [mountloc] section is nothing but url prefix on which a web-application instance is mounted. When a web-request enter the platform environment it is first resolved for the correct web-application under which the request must be handled. On the right hand side of the [mountloc] section a web-application is identified by its name and an optional configuration file, called ``application configuration file``, shall override configuration settings for all plugins invoked under the webapp's context, there by plugins can have different behaviour for each web-application. Note that, `application configuration file` will accept only plugin sections and [DEFAULT] special-section. Any other section will be silently ignore. **plugin section** Every plugin can have its configuration settings organised under a separate section. The title of the section should look like, .. code-block:: ini [plugin:.] `.` is called as the canonical name of plugin. **An example master configuration file,** .. code-block:: ini :linenos: master.ini ---------- [DEFAULT]