Sfoglia il codice sorgente

Merge pull request #8732 from thalesmg/fix-missing-descs-license

docs: add missing descriptions for license schema fields
Thales Macedo Garitezi 3 anni fa
parent
commit
82377d4b33

+ 77 - 0
lib-ee/emqx_license/i18n/emqx_license_schema_i18n.conf

@@ -0,0 +1,77 @@
+emqx_license_schema {
+  license_root {
+    desc {
+      en: "Defines the EMQX Enterprise license. \n\n"
+          "A license is either a `key` or a `file`.\n"
+          "When `key` and `file` are both configured, `key` is used.\n"
+          "\n"
+          "EMQX comes with a default trial license.  For production use, please \n"
+          "visit https://www.emqx.com/apply-licenses/emqx to apply."
+      zh: "EMQX企业许可证。\n"
+          "许可证是一个 `key` 或一个 `file`。\n"
+          "当 `key` 和 `file` 同时被配置时,优先使用 `key`。\n"
+          "\n"
+          "EMQX 自带一个默认的试用许可证,若需要在生产环境部署,\n"
+          "请访问 https://www.emqx.com/apply-licenses/emqx 来申请。\n"
+    }
+    label {
+      en: "License"
+      zh: "许可证"
+    }
+  }
+
+  license_type_field {
+    desc {
+      en: "License type"
+      zh: "许可证类型"
+    }
+    label {
+      en: "License type"
+      zh: "许可证类型"
+    }
+  }
+
+  key_field {
+    desc {
+      en: "License string"
+      zh: "许可证字符串"
+    }
+    label {
+      en: "License string"
+      zh: "许可证字符串"
+    }
+  }
+
+  file_field {
+    desc {
+      en: "Path to the license file"
+      zh: "许可证文件的路径"
+    }
+    label {
+      en: "Path to the license file"
+      zh: "许可证文件的路径"
+    }
+  }
+
+  connection_low_watermark_field {
+    desc {
+      en: "Low watermark limit below which license connection quota usage alarms are deactivated"
+      zh: "低水位限制,低于此水位线时系统会清除连接配额使用告警"
+    }
+    label {
+      en: "Connection low watermark"
+      zh: "连接低水位线"
+    }
+  }
+
+  connection_high_watermark_field {
+    desc {
+      en: "High watermark limit above which license connection quota usage alarms are activated"
+      zh: "高水位线,连接数超过这个水位线时,系统会触发许可证连接配额使用告警"
+    }
+    label {
+      en: "Connection high watermark"
+      zh: "连接高水位"
+    }
+  }
+}

+ 14 - 15
lib-ee/emqx_license/src/emqx_license_schema.erl

@@ -5,6 +5,7 @@
 -module(emqx_license_schema).
 
 -include_lib("typerefl/include/types.hrl").
+-include_lib("hocon/include/hoconsc.hrl").
 
 %%------------------------------------------------------------------------------
 %% hocon_schema callbacks
@@ -26,13 +27,7 @@ roots() ->
             hoconsc:mk(
                 license_type(),
                 #{
-                    desc =>
-                        "EMQX Enterprise license.\n"
-                        "A license is either a `key` or a `file`.\n"
-                        "When `key` and `file` are both configured, `key` is used.\n"
-                        "\n"
-                        "EMQX by default starts with a trial license.  For a different license,\n"
-                        "visit https://www.emqx.com/apply-licenses/emqx to apply.\n"
+                    desc => ?DESC(license_root)
                 }
             )}
     ].
@@ -41,18 +36,20 @@ fields(key_license) ->
     [
         {type, #{
             type => key,
-            required => true
+            required => true,
+            desc => ?DESC(license_type_field)
         }},
         {key, #{
             type => string(),
             %% so it's not logged
             sensitive => true,
             required => true,
-            desc => "License string"
+            desc => ?DESC(key_field)
         }},
         {file, #{
             type => string(),
-            required => false
+            required => false,
+            desc => ?DESC(file_field)
         }}
         | common_fields()
     ];
@@ -60,17 +57,19 @@ fields(file_license) ->
     [
         {type, #{
             type => file,
-            required => true
+            required => true,
+            desc => ?DESC(license_type_field)
         }},
         {key, #{
             type => string(),
             %% so it's not logged
             sensitive => true,
-            required => false
+            required => false,
+            desc => ?DESC(key_field)
         }},
         {file, #{
             type => string(),
-            desc => "Path to the license file"
+            desc => ?DESC(file_field)
         }}
         | common_fields()
     ].
@@ -87,12 +86,12 @@ common_fields() ->
         {connection_low_watermark, #{
             type => emqx_schema:percent(),
             default => "75%",
-            desc => ""
+            desc => ?DESC(connection_low_watermark_field)
         }},
         {connection_high_watermark, #{
             type => emqx_schema:percent(),
             default => "80%",
-            desc => ""
+            desc => ?DESC(connection_high_watermark_field)
         }}
     ].