Plugins configuration

External interfaces

Each plugin can store its own settings independently in file /plugins/<plugin_name>/config.ini.

The platform provides:

  • common interfaces for reading the plugins settings using the class PluginConfigReader;
  • output the availability of configs of plugins via /<prefix>/plugin;
  • web interface for reading/editing configs of the plugins /<instance_perfix>/plugin_config/<plugin_name> (р PluginConfigResource):
    • GET – returns the content of a plugin;
    • PUT – rewrites the config again;
    • Transfer/receiving data is performed in format JSON.
{  
  section1: {param1:val1, param2: val2},
  section1: {param3:val3},
}

 Software interfaces

PluginConfigReader

class PluginConfigReader:
    def __init__(self, pluginName):
    # Returns content of the config.ini in a form of a dictionary

    def getConfigContent(self):
    # Sets plugin config.ini content to content dictionary


    def setConfigContent(self, content):

PluginConfigResource

class PluginConfigResource(Resource):
    @possibleException
    def get(self, pluginName):
        # Check the presence of plugin with the specified name 
        return PluginConfigReader().getConfigContent()


    @possibleException
    def put(self, pluginName):
        # Check the presence of plugin with the specified name 
        # call PluginConfigReader().setConfigContent(postData)
ShareShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on VKEmail this to someone