diff --git a/doc/developers-guide/domain_management.md b/doc/developers-guide/domain_management.md index 9424adf8c6..d2ce78b765 100644 --- a/doc/developers-guide/domain_management.md +++ b/doc/developers-guide/domain_management.md @@ -101,6 +101,21 @@ Configure host-type first to delete such domains. ## Service options +```toml +[services.service_domain_db] + db_pool = "global" + event_cleaning_interval = 1800 + event_max_age = 7200 +``` + +### `db_pool` +By default, this service uses the RDBMS connection pool configured with the scope `"global"`. +You can put a specific host type there to use the pool with the `"host"` or `"single_host"` scope for that particular host type. See [outgoing connections docs](../advanced-configuration/outgoing-connections.md) for more information about pool scopes. + +* **Syntax:** string +* **Default:** `global` +* **Example:** `db_pool = "my_host_type"` + ### `event_cleaning_interval` The number of seconds between cleaning attempts of the `domain_events` table. * **Syntax:** positive integer diff --git a/src/domain/mongoose_domain_sql.erl b/src/domain/mongoose_domain_sql.erl index 89dde67c1d..438f54d0ef 100644 --- a/src/domain/mongoose_domain_sql.erl +++ b/src/domain/mongoose_domain_sql.erl @@ -260,7 +260,10 @@ row_to_map({HostType, Enabled}) -> #{host_type => HostType, enabled => mongoose_rdbms:to_bool(Enabled)}. get_db_pool() -> - hd(ejabberd_config:get_global_option(hosts)). + proplists:get_value(db_pool, get_service_opts(), global). + +get_service_opts() -> + mongoose_service:get_service_opts(service_domain_db). transaction(F) -> Pool = get_db_pool(), diff --git a/src/domain/service_domain_db.erl b/src/domain/service_domain_db.erl index 9c2074a277..b8db96601c 100644 --- a/src/domain/service_domain_db.erl +++ b/src/domain/service_domain_db.erl @@ -57,7 +57,9 @@ config_spec() -> <<"event_cleaning_interval">> => #option{type = integer, validate = positive}, <<"event_max_age">> => #option{type = integer, - validate = positive} + validate = positive}, + <<"db_pool">> => #option{type = atom, + validate = pool_name} }}. start_link() ->