You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2013/10/03 16:13:39 UTC
[26/42] git commit: updated refs/heads/master to a4d6cd4
make plugin dir configurable
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/ef145a96
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/ef145a96
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/ef145a96
Branch: refs/heads/master
Commit: ef145a968248f2f9a272a1763053140b0560c1e7
Parents: f9f10fe
Author: Jan Lehnardt <ja...@apache.org>
Authored: Thu Aug 1 19:14:03 2013 +0200
Committer: Jan Lehnardt <ja...@apache.org>
Committed: Thu Oct 3 16:08:36 2013 +0200
----------------------------------------------------------------------
etc/couchdb/default.ini.tpl.in | 2 ++
src/couch_plugins/src/couch_plugins.erl | 11 ++++++-----
2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/ef145a96/etc/couchdb/default.ini.tpl.in
----------------------------------------------------------------------
diff --git a/etc/couchdb/default.ini.tpl.in b/etc/couchdb/default.ini.tpl.in
index 7645c33..3267001 100644
--- a/etc/couchdb/default.ini.tpl.in
+++ b/etc/couchdb/default.ini.tpl.in
@@ -27,6 +27,8 @@ file_compression = snappy
; time for writes when there are many attachment write requests in parallel.
attachment_stream_buffer_size = 4096
+plugin_dir = %locallibdir%/plugins
+
[database_compaction]
; larger buffer sizes can originate smaller files
doc_buffer_size = 524288 ; value in bytes
http://git-wip-us.apache.org/repos/asf/couchdb/blob/ef145a96/src/couch_plugins/src/couch_plugins.erl
----------------------------------------------------------------------
diff --git a/src/couch_plugins/src/couch_plugins.erl b/src/couch_plugins/src/couch_plugins.erl
index bbfa1e4..dfd59a2 100644
--- a/src/couch_plugins/src/couch_plugins.erl
+++ b/src/couch_plugins/src/couch_plugins.erl
@@ -16,7 +16,8 @@
% couch_plugins:install({"geocouch", "http://127.0.0.1:8000", "1.0.0", [{"R15B03", "+XOJP6GSzmuO2qKdnjO+mWckXVs="}]}).
% couch_plugins:install({"geocouch", "http://people.apache.org/~jan/", "couchdb1.2.x_v0.3.0-11-gd83ba22", [{"R15B03", "ZetgdHj2bY2w37buulWVf3USOZs="}]}).
--define(PLUGIN_DIR, "/tmp/couchdb_plugins").
+plugin_dir() ->
+ couch_config:get("couchdb", "plugin_dir").
log(T) ->
?LOG_DEBUG("[couch_plugins] ~p ~n", [T]).
@@ -60,7 +61,7 @@ load_config(Name, Version) ->
fun load_config_file/1,
filelib:wildcard(
filename:join(
- [?PLUGIN_DIR, get_file_slug(Name, Version),
+ [plugin_dir(), get_file_slug(Name, Version),
"priv", "default.d", "*.ini"]))).
-spec load_config_file(string()) -> ok.
@@ -74,7 +75,7 @@ set_config({{Section, Key}, Value}) ->
-spec add_code_path(string(), string()) -> ok | {error, bad_directory}.
add_code_path(Name, Version) ->
- PluginPath = ?PLUGIN_DIR ++ "/" ++ get_file_slug(Name, Version) ++ "/ebin",
+ PluginPath = plugin_dir() ++ "/" ++ get_file_slug(Name, Version) ++ "/ebin",
case code:add_path(PluginPath) of
true -> ok;
Else ->
@@ -95,9 +96,9 @@ untargz(Filename) ->
% gunzip
log("unzipped"),
TarData = zlib:gunzip(GzData),
- ok = filelib:ensure_dir(?PLUGIN_DIR),
+ ok = filelib:ensure_dir(plugin_dir()),
% untar
- erl_tar:extract({binary, TarData}, [{cwd, ?PLUGIN_DIR}, keep_old_files]).
+ erl_tar:extract({binary, TarData}, [{cwd, plugin_dir()}, keep_old_files]).
% downloads a pluygin .tar.gz into a local plugins directory