I've recreated my simple erlang plugins system

  http://github.com/AntonyBlakey/couchdb/tree/simple-erlang-plugins

A plugin is a directory. It can contain a plugin.ini file and an erlang directory.

The erlang directory is added to the erlang load path - you put your beam files in there.

The plugin.ini file is loaded after the default.ini, but before local.ini. If you supply your own ini files on the command line then it comes before them.

To start your plugin you probably want to add to the [daemons] section of your plugin.ini file. Check start_secondary_services in couch_server_sup.erl to see what happens with daemons, and you can see examples in default.ini (.tpl.in in the source).

If plugins need to be integrated in a different fashion, or dependencies are needed, then I'd suggest that a different config section be created to handle richer specification/invocation option format than [daemons].

There are command line options for manipulating the list of plugins. By default it will load plugins from /etc/couchdb/plugins/ or whatever your localconfdir is - mine is always relative - but this can be controlled by the options:
  -C      clean the plugins list
  -D      add all the plugins in $DEFAULT_PLUGIN_DIR
  -G DIR  add all the plugins in DIR
  -P DIR  add the plugin DIR
Bit light on testing, I wanted to show how trivial it is.

Antony Blakey
-------------
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies.
  -- C. A. R. Hoare


Reply via email to