mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
* doc/guide.tex: Improve documentation of host_config
add (EJAB-544) * doc/guide.html: Likewise * src/ejabberd.cfg.example: Likewise * src/ejabberd_config.erl: Likewise SVN Revision: 1219
This commit is contained in:
parent
a65273690d
commit
735b34e7b7
@ -1,5 +1,11 @@
|
|||||||
2008-03-04 Badlop <badlop@process-one.net>
|
2008-03-04 Badlop <badlop@process-one.net>
|
||||||
|
|
||||||
|
* doc/guide.tex: Improve documentation of host_config
|
||||||
|
add (EJAB-544)
|
||||||
|
* doc/guide.html: Likewise
|
||||||
|
* src/ejabberd.cfg.example: Likewise
|
||||||
|
* src/ejabberd_config.erl: Likewise
|
||||||
|
|
||||||
* doc/guide.tex: mod_announce recommends, but doesn't require
|
* doc/guide.tex: mod_announce recommends, but doesn't require
|
||||||
mod_adhoc (thanks to Anastasia Gornostaeva)
|
mod_adhoc (thanks to Anastasia Gornostaeva)
|
||||||
* doc/guide.html: Likewise
|
* doc/guide.html: Likewise
|
||||||
|
@ -552,18 +552,16 @@ while domain <TT>example.com</TT> is using the LDAP servers running on the domai
|
|||||||
{ldap_rootdn, "dc=localdomain"},
|
{ldap_rootdn, "dc=localdomain"},
|
||||||
{ldap_rootdn, "dc=example,dc=com"},
|
{ldap_rootdn, "dc=example,dc=com"},
|
||||||
{ldap_password, ""}]}.
|
{ldap_password, ""}]}.
|
||||||
</PRE></LI></UL><P>If you have several virtual hosts,
|
</PRE></LI></UL><P>To define specific ejabberd modules in a virtual host,
|
||||||
and you want to define options such as <TT>modules</TT>
|
you can define the global <TT>modules</TT> option with the common modules,
|
||||||
with values specific for some virtual host,
|
and later add specific modules to certain virtual hosts.
|
||||||
instead of defining each option with the syntax
|
To accomplish that, instead of defining each option in <TT>host_config</TT> with the syntax
|
||||||
</P><PRE CLASS="verbatim"> {<option-name>, <option-value>}
|
</P><PRE CLASS="verbatim"> {<option-name>, <option-value>}
|
||||||
</PRE><P>you must use this syntax:
|
</PRE><P>you must use this syntax:
|
||||||
</P><PRE CLASS="verbatim"> {{add, <option-name>}, <option-value>}
|
</P><PRE CLASS="verbatim"> {{add, <option-name>}, <option-value>}
|
||||||
</PRE><P>Example:
|
</PRE><P>In this example three virtual hosts have some similar modules, but there are also
|
||||||
</P><UL CLASS="itemize"><LI CLASS="li-itemize">
|
|
||||||
In this example three virtual hosts have some similar modules, but there are also
|
|
||||||
other different modules for some specific virtual hosts:
|
other different modules for some specific virtual hosts:
|
||||||
<PRE CLASS="verbatim">% This ejabberd server has three vhosts:
|
</P><PRE CLASS="verbatim">% This ejabberd server has three vhosts:
|
||||||
{hosts, ["one.example.org", "two.example.org", "three.example.org"]}.
|
{hosts, ["one.example.org", "two.example.org", "three.example.org"]}.
|
||||||
|
|
||||||
% Configuration of modules that are common to all vhosts
|
% Configuration of modules that are common to all vhosts
|
||||||
@ -589,7 +587,7 @@ instead of defining each option with the syntax
|
|||||||
{host_config, "two.example.org", [{{add, modules}, [
|
{host_config, "two.example.org", [{{add, modules}, [
|
||||||
{mod_echo, [{host, "mirror.two.example.org"}]}
|
{mod_echo, [{host, "mirror.two.example.org"}]}
|
||||||
]}]}.
|
]}]}.
|
||||||
</PRE></LI></UL><!--TOC subsection Listening Ports-->
|
</PRE><!--TOC subsection Listening Ports-->
|
||||||
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc22">3.1.3</A>  Listening Ports</H3><!--SEC END --><P>
|
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc22">3.1.3</A>  Listening Ports</H3><!--SEC END --><P>
|
||||||
<A NAME="listened"></A>
|
<A NAME="listened"></A>
|
||||||
</P><P>The option <TT>listen</TT> defines for which addresses and ports <TT>ejabberd</TT>
|
</P><P>The option <TT>listen</TT> defines for which addresses and ports <TT>ejabberd</TT>
|
||||||
|
@ -591,21 +591,19 @@ Examples:
|
|||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
||||||
If you have several virtual hosts,
|
To define specific ejabberd modules in a virtual host,
|
||||||
and you want to define options such as \term{modules}
|
you can define the global \term{modules} option with the common modules,
|
||||||
with values specific for some virtual host,
|
and later add specific modules to certain virtual hosts.
|
||||||
instead of defining each option with the syntax
|
To accomplish that, instead of defining each option in \term{host\_config} with the syntax
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
{<option-name>, <option-value>}
|
{<option-name>, <option-value>}
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
you must use this syntax:
|
use this syntax:
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
{{add, <option-name>}, <option-value>}
|
{{add, <option-name>}, <option-value>}
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
Example:
|
In this example three virtual hosts have some similar modules, but there are also
|
||||||
\begin{itemize}
|
|
||||||
\item In this example three virtual hosts have some similar modules, but there are also
|
|
||||||
other different modules for some specific virtual hosts:
|
other different modules for some specific virtual hosts:
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
% This ejabberd server has three vhosts:
|
% This ejabberd server has three vhosts:
|
||||||
@ -635,7 +633,6 @@ Example:
|
|||||||
{mod_echo, [{host, "mirror.two.example.org"}]}
|
{mod_echo, [{host, "mirror.two.example.org"}]}
|
||||||
]}]}.
|
]}]}.
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
\end{itemize}
|
|
||||||
|
|
||||||
\subsection{Listening Ports}
|
\subsection{Listening Ports}
|
||||||
\label{listened}
|
\label{listened}
|
||||||
|
@ -341,6 +341,15 @@
|
|||||||
%%{acl, test, {user_regexp, "^test"}}.
|
%%{acl, test, {user_regexp, "^test"}}.
|
||||||
%%{acl, test, {user_glob, "test*"}}.
|
%%{acl, test, {user_glob, "test*"}}.
|
||||||
|
|
||||||
|
%%
|
||||||
|
%% Define specific ACLs in a virtual host.
|
||||||
|
%%
|
||||||
|
%%{host_config, "localhost",
|
||||||
|
%% [
|
||||||
|
%% {acl, admin, {user, "bob-local", "localhost"}}
|
||||||
|
%% ]
|
||||||
|
%%}.
|
||||||
|
|
||||||
|
|
||||||
%%% ============
|
%%% ============
|
||||||
%%% ACCESS RULES
|
%%% ACCESS RULES
|
||||||
@ -381,6 +390,16 @@
|
|||||||
%% Everybody can create pubsub nodes
|
%% Everybody can create pubsub nodes
|
||||||
{access, pubsub_createnode, [{allow, all}]}.
|
{access, pubsub_createnode, [{allow, all}]}.
|
||||||
|
|
||||||
|
%%
|
||||||
|
%% Define specific Access rules in a virtual host.
|
||||||
|
%%
|
||||||
|
%%{host_config, "localhost",
|
||||||
|
%% [
|
||||||
|
%% {access, c2s, [{allow, admin}, {deny, all}]},
|
||||||
|
%% {access, register, [{deny, all}]}
|
||||||
|
%% ]
|
||||||
|
%%}.
|
||||||
|
|
||||||
|
|
||||||
%%% ================
|
%%% ================
|
||||||
%%% DEFAULT LANGUAGE
|
%%% DEFAULT LANGUAGE
|
||||||
@ -390,6 +409,13 @@
|
|||||||
%%
|
%%
|
||||||
{language, "en"}.
|
{language, "en"}.
|
||||||
|
|
||||||
|
%%
|
||||||
|
%% Set a different language in a virtual host.
|
||||||
|
%%
|
||||||
|
%%{host_config, "localhost",
|
||||||
|
%% [{language, "ru"}]
|
||||||
|
%%}.
|
||||||
|
|
||||||
|
|
||||||
%%% =======
|
%%% =======
|
||||||
%%% MODULES
|
%%% MODULES
|
||||||
@ -448,6 +474,17 @@
|
|||||||
{mod_version, []}
|
{mod_version, []}
|
||||||
]}.
|
]}.
|
||||||
|
|
||||||
|
%%
|
||||||
|
%% Enable modules with custom options in a specific virtual host
|
||||||
|
%%
|
||||||
|
%%{host_config, "localhost",
|
||||||
|
%% [{{add, modules},
|
||||||
|
%% [
|
||||||
|
%% {mod_echo, [{host, "mirror.localhost"}]}
|
||||||
|
%% ]
|
||||||
|
%% }
|
||||||
|
%% ]}.
|
||||||
|
|
||||||
|
|
||||||
%%% $Id$
|
%%% $Id$
|
||||||
|
|
||||||
|
@ -211,11 +211,16 @@ add_option(Opt, Val, State) ->
|
|||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
compact(Opt, Val, [], Os) ->
|
compact({OptName, Host} = Opt, Val, [], Os) ->
|
||||||
|
?WARNING_MSG("The option '~p' is defined for the host ~p using host_config "
|
||||||
|
"before the global '~p' option. This host_config option may get overwritten.", [OptName, Host, OptName]),
|
||||||
[#local_config{key = Opt, value = Val}] ++ Os;
|
[#local_config{key = Opt, value = Val}] ++ Os;
|
||||||
|
%% Traverse the list of the options already parsed
|
||||||
compact(Opt, Val, [O | Os1], Os2) ->
|
compact(Opt, Val, [O | Os1], Os2) ->
|
||||||
case O#local_config.key of
|
case catch O#local_config.key of
|
||||||
|
%% If the key of a local_config matches the Opt that wants to be added
|
||||||
Opt ->
|
Opt ->
|
||||||
|
%% Then prepend the new value to the list of old values
|
||||||
Os2 ++ [#local_config{key = Opt,
|
Os2 ++ [#local_config{key = Opt,
|
||||||
value = Val++O#local_config.value}
|
value = Val++O#local_config.value}
|
||||||
] ++ Os1;
|
] ++ Os1;
|
||||||
|
Loading…
Reference in New Issue
Block a user