diff options
author | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-04-29 11:39:40 +0300 |
---|---|---|
committer | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-04-29 11:39:40 +0300 |
commit | b82b93f8f0c229e94a89469b0754bab0e28cd17c (patch) | |
tree | 56f5c7a25aa19254b4f30b1cf33fc34dcbadcbb7 /src/ejabberd_redis_sup.erl | |
parent | Don't re-define validation functions in multiple places (diff) |
Don't validate an option in ejabberd_config:get_option() functions
The commit introduces the following changes:
* Now there is no need to pass validating function in
ejabberd_config:get_option() functions, because the configuration
keeps already validated values.
* New function ejabberd_config:get_option/1 is introduced
* Function ejabberd_config:get_option/3 is deprecated. If the function
is still called, the second argument (validating function) is simply
ignored.
* The second argument for ejabberd_config:get_option/2 is now
a default value, not a validating function.
Diffstat (limited to 'src/ejabberd_redis_sup.erl')
-rw-r--r-- | src/ejabberd_redis_sup.erl | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/src/ejabberd_redis_sup.erl b/src/ejabberd_redis_sup.erl index da9fe37cf..85cfd7abb 100644 --- a/src/ejabberd_redis_sup.erl +++ b/src/ejabberd_redis_sup.erl @@ -108,15 +108,9 @@ is_redis_configured(Host) -> PoolSize = ejabberd_config:has_option({redis_pool_size, Host}), ConnTimeoutConfigured = ejabberd_config:has_option( {redis_connect_timeout, Host}), - Modules = ejabberd_config:get_option( - {modules, Host}, - fun(L) when is_list(L) -> L end, []), - SMConfigured = ejabberd_config:get_option( - {sm_db_type, Host}, - fun(V) -> V end) == redis, - RouterConfigured = ejabberd_config:get_option( - {router_db_type, Host}, - fun(V) -> V end) == redis, + Modules = ejabberd_config:get_option({modules, Host}, []), + SMConfigured = ejabberd_config:get_option({sm_db_type, Host}) == redis, + RouterConfigured = ejabberd_config:get_option({router_db_type, Host}) == redis, ModuleWithRedisDBConfigured = lists:any( fun({Module, Opts}) -> @@ -134,10 +128,7 @@ get_specs() -> end, lists:seq(1, get_pool_size())). get_pool_size() -> - ejabberd_config:get_option( - redis_pool_size, - fun(N) when is_integer(N), N >= 1 -> N end, - ?DEFAULT_POOL_SIZE) + 1. + ejabberd_config:get_option(redis_pool_size, ?DEFAULT_POOL_SIZE) + 1. iolist_to_list(IOList) -> binary_to_list(iolist_to_binary(IOList)). |