]> granicus.if.org Git - ejabberd/commitdiff
Only lookup FQDN at configuration (re)loading
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>
Fri, 6 Jul 2018 06:18:27 +0000 (09:18 +0300)
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>
Fri, 6 Jul 2018 06:18:27 +0000 (09:18 +0300)
rebar.config
src/ejabberd_config.erl

index 35dfb3553537a5d80b4944ace7106e97cdfdf8d9..7c77b65616c18be32254eea678298e2fb168aefe 100644 (file)
@@ -25,7 +25,7 @@
         {fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.0.23"}}},
         {stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.12"}}},
         {fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.32"}}},
-        {xmpp, ".*", {git, "https://github.com/processone/xmpp", "2a5193c"}},
+        {xmpp, ".*", {git, "https://github.com/processone/xmpp", "64fbddd"}},
         {fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.15"}}},
         {jiffy, ".*", {git, "https://github.com/davisp/jiffy", {tag, "0.14.8"}}},
         {p1_oauth2, ".*", {git, "https://github.com/processone/p1_oauth2", {tag, "0.6.3"}}},
index 5dcb247110a93d08239d6f960c8235da8114abe6..a3165143035b00ad84873dd638dfc35de410390a 100644 (file)
@@ -57,6 +57,7 @@
 -include("logger.hrl").
 -include("ejabberd_config.hrl").
 -include_lib("kernel/include/file.hrl").
+-include_lib("kernel/include/inet.hrl").
 -include_lib("stdlib/include/ms_transform.hrl").
 
 -callback opt_type(atom()) -> function() | [atom()].
@@ -786,7 +787,18 @@ set_opts(State) ->
     set_log_level().
 
 set_fqdn() ->
-    FQDNs = get_option(fqdn, []),
+    FQDNs = case get_option(fqdn, []) of
+               [] ->
+                   {ok, Hostname} = inet:gethostname(),
+                   case inet:gethostbyname(Hostname) of
+                       {ok, #hostent{h_name = FQDN}} ->
+                           [iolist_to_binary(FQDN)];
+                       {error, _} ->
+                           []
+                   end;
+               Domains ->
+                   Domains
+             end,
     xmpp:set_config([{fqdn, FQDNs}]).
 
 set_log_level() ->