aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rebar.config2
-rw-r--r--src/ejabberd_config.erl14
2 files changed, 14 insertions, 2 deletions
diff --git a/rebar.config b/rebar.config
index 35dfb3553..7c77b6561 100644
--- a/rebar.config
+++ b/rebar.config
@@ -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"}}},
diff --git a/src/ejabberd_config.erl b/src/ejabberd_config.erl
index 5dcb24711..a31651430 100644
--- a/src/ejabberd_config.erl
+++ b/src/ejabberd_config.erl
@@ -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() ->