Reputation: 21
Is it possible to add a virtual host programmatically to ejabberd, without manually editing ejabberd.cfg and restart the server?
I see there are many new features released in latest ejabberd 19.* Like rest APIs, is it plausible to dynamically add virtual via REST APIs.
Upvotes: 2
Views: 1284
Reputation: 2402
No, as of 2024 it isn't possible to use the ejabberd REST API or command line instructions to add or modify the virtual hosts, though the registered_hosts
command will list them.
Upvotes: 1
Reputation: 4120
I see there are many new features released in latest ejabberd 19.* Like rest APIs, is it plausible to dynamically add virtual via REST APIs.
I don't see any new command to execute to add a new host.
Is it possible to add a virtual host programmatically to ejabberd, without manually editing ejabberd.cfg and restart the server?
Well, you can edit configuration file programmatically. You probably will prefer to put the hosts option in another file. Example:
In ejabberd.yml
include_config_file: /etc/ejabberd/hosts.yml
# hosts
# - example.org
...
In the new file hosts.yml put:
hosts:
- example.org
And now you can add new hosts to that config file, and reload all it:
$ echo " - example.net" >> /etc/ejabberd/hosts.yml
$ ejabberdctl reload_config
Upvotes: 2