diff options
author | Jan Lehnardt <jan@apache.org> | 2013-08-01 18:44:45 +0200 |
---|---|---|
committer | Jan Lehnardt <jan@apache.org> | 2013-10-03 16:08:36 +0200 |
commit | 21e839a22f6879ec8f03d9b4ea3fde7712e0faf0 (patch) | |
tree | e3e9afec894796199d1111183438dba11554b42a | |
parent | 084c8b4c367b909ba3b90bc7a901333ea5b676d6 (diff) | |
download | couchdb-21e839a22f6879ec8f03d9b4ea3fde7712e0faf0.tar.gz |
register plugins at _config/plugins/pluginname with their version number
-rw-r--r-- | src/couch_plugins/README.md | 2 | ||||
-rw-r--r-- | src/couch_plugins/src/couch_plugins.erl | 13 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/couch_plugins/README.md b/src/couch_plugins/README.md index 8851794b6..081788de7 100644 --- a/src/couch_plugins/README.md +++ b/src/couch_plugins/README.md @@ -48,13 +48,13 @@ Here’s a list of things this first iterations does and doesn’t do: - Only installs if Erlang version matches. - No security checking of binaries. - No identity checking of binaries. +- Register installed plugins in the config system. Here are a few things I want to add before I call it MVP*: - Uninstall a plugin via Futon (or HTTP call). Admin only. - Only installs if CouchDB version matches. - Binaries must be published on *.apache.org. -- Register installed plugins in the config system. - Make sure plugins start with the next restart of CouchDB. - Show when a particular plugin is installed. diff --git a/src/couch_plugins/src/couch_plugins.erl b/src/couch_plugins/src/couch_plugins.erl index a7680c37a..bbfa1e4be 100644 --- a/src/couch_plugins/src/couch_plugins.erl +++ b/src/couch_plugins/src/couch_plugins.erl @@ -39,12 +39,21 @@ install({Name, _BaseUrl, Version, Checksums}=Plugin) -> ok = add_code_path(Name, Version), log("added code path"), - ok = load_config(Name, Version), - load_plugin(Name), + ok = register_plugin(Name, Version), + log("registered plugin"), + ok = load_plugin(Name), log("loaded plugin"), + + load_config(Name, Version), + log("loaded config"), + ok. +-spec register_plugin(string(), string()) -> ok. +register_plugin(Name, Version) -> + couch_config:set("plugins", Name, Version). + -spec load_config(string(), string()) -> ok. load_config(Name, Version) -> lists:foreach( |