From 7bb590f1c78840e8cc36cc52e15bdc2f4d44c835 Mon Sep 17 00:00:00 2001 From: Zaiming Shi Date: Fri, 22 Jan 2021 09:53:00 +0100 Subject: [PATCH] refactor(auth_redis): delete backward-compatible code in config schema --- .../priv/emqx_auth_redis.schema | 36 ++++--------------- 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/apps/emqx_auth_redis/priv/emqx_auth_redis.schema b/apps/emqx_auth_redis/priv/emqx_auth_redis.schema index 69a3cf388..299e1bae3 100644 --- a/apps/emqx_auth_redis/priv/emqx_auth_redis.schema +++ b/apps/emqx_auth_redis/priv/emqx_auth_redis.schema @@ -43,7 +43,6 @@ {datatype, string} ]}. -%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0 {mapping, "auth.redis.ssl.certfile", "emqx_auth_redis.options", [ {default, ""}, {datatype, string} @@ -54,40 +53,17 @@ {datatype, string} ]}. -%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0 -{mapping, "auth.redis.cafile", "emqx_auth_redis.options", [ - {default, ""}, - {datatype, string} -]}. - -%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0 -{mapping, "auth.redis.certfile", "emqx_auth_redis.options", [ - {default, ""}, - {datatype, string} -]}. - -%% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0 -{mapping, "auth.redis.keyfile", "emqx_auth_redis.options", [ - {default, ""}, - {datatype, string} -]}. - {translation, "emqx_auth_redis.options", fun(Conf) -> - Ssl = cuttlefish:conf_get("auth.redis.ssl.enable", Conf, false), - case Ssl of + case cuttlefish:conf_get("auth.redis.ssl.enable", Conf, false) of true -> - %% FIXME: compatible with 4.0-4.2 version format, plan to delete in 5.0 - Prefix = case cuttlefish:conf_get("auth.redis.ssl.cacertfile", Conf, undefined) of - undefined -> "auth.redis"; - _ -> "auth.redis.ssl" - end, - CA = cuttlefish:conf_get(Prefix ++ ".cacertfile", Conf), - Cert = cuttlefish:conf_get(Prefix ++ ".certfile", Conf), - Key = cuttlefish:conf_get(Prefix ++ ".keyfile", Conf), + CA = cuttlefish:conf_get("auth.redis.ssl.cacertfile", Conf), + Cert = cuttlefish:conf_get("auth.redis.ssl.certfile", Conf), + Key = cuttlefish:conf_get("auth.redis.ssl.keyfile", Conf), [{options, [{ssl_options, [{cacertfile, CA}, {certfile, Cert}, {keyfile, Key}]}]}]; - _ -> [{options, []}] + false -> + [{options, []}] end end}.