From 6cd79f92e016256b19df8de74bff99697dc00c36 Mon Sep 17 00:00:00 2001 From: firest Date: Wed, 6 Jul 2022 17:04:12 +0800 Subject: [PATCH] fix(emqx_auth_http): make configure backward compatible --- apps/emqx_auth_http/etc/emqx_auth_http.conf | 2 +- .../emqx_auth_http/priv/emqx_auth_http.schema | 23 +++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/apps/emqx_auth_http/etc/emqx_auth_http.conf b/apps/emqx_auth_http/etc/emqx_auth_http.conf index 584448046..458a1d0a0 100644 --- a/apps/emqx_auth_http/etc/emqx_auth_http.conf +++ b/apps/emqx_auth_http/etc/emqx_auth_http.conf @@ -139,7 +139,7 @@ auth.http.pool_size = 32 ## Whether to enable HTTP Pipelining ## ## See: https://en.wikipedia.org/wiki/HTTP_pipelining -auth.http.enable_pipelining = true +auth.http.enable_pipelining = 100 ##------------------------------------------------------------------------------ ## SSL options diff --git a/apps/emqx_auth_http/priv/emqx_auth_http.schema b/apps/emqx_auth_http/priv/emqx_auth_http.schema index 59a0c09b9..627870b58 100644 --- a/apps/emqx_auth_http/priv/emqx_auth_http.schema +++ b/apps/emqx_auth_http/priv/emqx_auth_http.schema @@ -110,10 +110,29 @@ end}. ]}. {mapping, "auth.http.enable_pipelining", "emqx_auth_http.enable_pipelining", [ - {default, 100}, - {datatype, integer} + {default, "100"}, + {datatype, string} ]}. +{translation, "emqx_auth_http.enable_pipelining", fun(Conf) -> + case cuttlefish:conf_get("auth.http.enable_pipelining", Conf, undefined) of + undefined -> 100; + Str -> + try + erlang:list_to_integer(Str) + catch _:_ -> + case erlang:list_to_atom(Str) of + true -> + 100; + false -> + 1; + _ -> + 100 + end + end + end +end}. + {mapping, "auth.http.ssl.cacertfile", "emqx_auth_http.cacertfile", [ {datatype, string} ]}.