Bläddra i källkod

fix: license could not be viewed through the Dashboard after updating from the command line

JianBo He 1 år sedan
förälder
incheckning
6de05719ed

+ 1 - 1
apps/emqx_license/src/emqx_license.app.src

@@ -1,6 +1,6 @@
 {application, emqx_license, [
     {description, "EMQX License"},
-    {vsn, "5.1.1"},
+    {vsn, "5.1.2"},
     {modules, []},
     {registered, [emqx_license_sup]},
     {applications, [kernel, stdlib, emqx_ctl, emqx_gateway]},

+ 2 - 1
apps/emqx_license/src/emqx_license.erl

@@ -61,7 +61,8 @@ unload() ->
 -spec update_key(binary() | string()) ->
     {ok, emqx_config:update_result()} | {error, emqx_config:update_error()}.
 update_key(Value) when is_binary(Value); is_list(Value) ->
-    Result = exec_config_update({key, Value}),
+    Value1 = emqx_utils_conv:bin(Value),
+    Result = exec_config_update({key, Value1}),
     handle_config_update_result(Result).
 
 update_setting(Setting) when is_map(Setting) ->

+ 9 - 0
apps/emqx_license/test/emqx_license_http_api_SUITE.erl

@@ -232,6 +232,15 @@ t_license_setting(_Config) ->
     ),
     ok.
 
+t_license_setting_updated_from_cli(_Config) ->
+    %% update license from cli
+    LicenseValue = binary_to_list(
+        emqx_license_test_lib:make_license(#{max_connections => "201"})
+    ),
+    _ = emqx_license_cli:license(["update", LicenseValue]),
+    ?assertMatch(#{<<"max_connections">> := 201}, request_dump()),
+    ok.
+
 t_license_setting_bc(_Config) ->
     %% Create a BC license
     Key = emqx_license_test_lib:make_license(#{