aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexey Shchepin <alexey@process-one.net>2007-09-11 11:20:36 +0000
committerAlexey Shchepin <alexey@process-one.net>2007-09-11 11:20:36 +0000
commite809c6c3226f25df1809b39278a3bc3043cf86dd (patch)
treebfb0831d5271be314bb2d305819a8da17fad8e0a /src
parentSVN Revision: 926 (diff)
* src/gen_mod.erl: Added get_module_opt_host/3 (thanks to Badlop)
SVN Revision: 927
Diffstat (limited to 'src')
-rw-r--r--src/gen_mod.erl11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gen_mod.erl b/src/gen_mod.erl
index 163a8b5dc..168c93df4 100644
--- a/src/gen_mod.erl
+++ b/src/gen_mod.erl
@@ -15,6 +15,7 @@
get_opt/3,
get_opt_host/3,
get_module_opt/4,
+ get_module_opt_host/3,
loaded_modules/1,
loaded_modules_with_opts/1,
get_hosts/2,
@@ -92,7 +93,7 @@ wait_for_stop1(MonitorReference) ->
get_opt(Opt, Opts) ->
case lists:keysearch(Opt, 1, Opts) of
false ->
- % TODO: replace with more appropriate function
+ % TODO: replace with more appropriate function
throw({undefined_option, Opt});
{value, {_, Val}} ->
Val
@@ -114,9 +115,9 @@ get_module_opt(global, Module, Opt, Default) ->
end,
Hosts),
Same_all = lists:all(
- fun(Other_value) ->
+ fun(Other_value) ->
Other_value == Value
- end,
+ end,
Values),
case Same_all of
true -> Value;
@@ -132,6 +133,10 @@ get_module_opt(Host, Module, Opt, Default) ->
get_opt(Opt, Opts, Default)
end.
+get_module_opt_host(Host, Module, Default) ->
+ Val = get_module_opt(Host, Module, host, Default),
+ element(2, regexp:gsub(Val, "@HOST@", Host)).
+
get_opt_host(Host, Opts, Default) ->
Val = get_opt(host, Opts, Default),
element(2, regexp:gsub(Val, "@HOST@", Host)).