From 900c6ec43e58a00098240206afdaa616ec7d48e5 Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Mon, 15 Aug 2022 13:35:55 -0300 Subject: [PATCH 1/3] docs: add missing descriptions for license schema fields --- .../i18n/emqx_license_schema_i18n.conf | 81 +++++++++++++++++++ .../emqx_license/src/emqx_license_schema.erl | 29 ++++--- 2 files changed, 95 insertions(+), 15 deletions(-) create mode 100644 lib-ee/emqx_license/i18n/emqx_license_schema_i18n.conf diff --git a/lib-ee/emqx_license/i18n/emqx_license_schema_i18n.conf b/lib-ee/emqx_license/i18n/emqx_license_schema_i18n.conf new file mode 100644 index 000000000..d91dcd89a --- /dev/null +++ b/lib-ee/emqx_license/i18n/emqx_license_schema_i18n.conf @@ -0,0 +1,81 @@ +emqx_license_schema { + license_root { + desc { + en: """ + EMQX Enterprise license. + A license is either a `key` or a `file`. + When `key` and `file` are both configured, `key` is used. + + EMQX by default starts with a trial license. For a different license, + visit https://www.emqx.com/apply-licenses/emqx to apply. + """ + zh: """ + EMQX企业许可证。 + 许可证是一个`钥匙'或一个`文件'。 + 当 "key "和 "file "都被配置时,使用 "key"。 + + EMQX默认以一个试用许可证开始。 对于不同的许可证。 + 请访问https://www.emqx.com/apply-licenses/emqx 来申请。 + """ + } + 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: "连接高水位" + } + } +} diff --git a/lib-ee/emqx_license/src/emqx_license_schema.erl b/lib-ee/emqx_license/src/emqx_license_schema.erl index ab0da3b9a..2ce768425 100644 --- a/lib-ee/emqx_license/src/emqx_license_schema.erl +++ b/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) }} ]. From 34c1c613431dc44115a4d7871d7bfd62f3ba4a5c Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Mon, 15 Aug 2022 16:37:50 -0300 Subject: [PATCH 2/3] docs: apply suggestions from code review Co-authored-by: Zaiming (Stone) Shi --- .../i18n/emqx_license_schema_i18n.conf | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib-ee/emqx_license/i18n/emqx_license_schema_i18n.conf b/lib-ee/emqx_license/i18n/emqx_license_schema_i18n.conf index d91dcd89a..86d25fce9 100644 --- a/lib-ee/emqx_license/i18n/emqx_license_schema_i18n.conf +++ b/lib-ee/emqx_license/i18n/emqx_license_schema_i18n.conf @@ -6,16 +6,16 @@ emqx_license_schema { A license is either a `key` or a `file`. When `key` and `file` are both configured, `key` is used. - EMQX by default starts with a trial license. For a different license, + EMQX comes with a default trial license. For production use, please visit https://www.emqx.com/apply-licenses/emqx to apply. """ zh: """ EMQX企业许可证。 - 许可证是一个`钥匙'或一个`文件'。 - 当 "key "和 "file "都被配置时,使用 "key"。 + 许可证是一个 `key` 或一个 `file`。 + 当 `key` 和 `file` 同时被配置时,优先使用 `key`。 - EMQX默认以一个试用许可证开始。 对于不同的许可证。 - 请访问https://www.emqx.com/apply-licenses/emqx 来申请。 + EMQX 自带一个默认的试用许可证,若需要在生产环境部署, + 请访问 https://www.emqx.com/apply-licenses/emqx 来申请。 """ } label { @@ -60,18 +60,18 @@ emqx_license_schema { connection_low_watermark_field { desc { en: "Low watermark limit below which license connection quota usage alarms are deactivated" - zh: "低水位限制,低于此水位的许可证连接配额使用警报被停用" + zh: "低水位限制,低于此水位线时系统会清除连接配额使用告警" } label { en: "Connection low watermark" - zh: "连接低水印" + zh: "连接低水位线" } } connection_high_watermark_field { desc { en: "High watermark limit above which license connection quota usage alarms are activated" - zh: "高水位限制,超过这个水位就会启动许可证连接配额使用警报" + zh: "高水位线,连接数超过这个水位线时,系统会触发许可证连接配额使用告警" } label { en: "Connection high watermark" From 7a31897f8ecfc1310021f58622313cd6b1b03058 Mon Sep 17 00:00:00 2001 From: Thales Macedo Garitezi Date: Mon, 15 Aug 2022 16:39:52 -0300 Subject: [PATCH 3/3] docs: add manual newlines --- .../i18n/emqx_license_schema_i18n.conf | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/lib-ee/emqx_license/i18n/emqx_license_schema_i18n.conf b/lib-ee/emqx_license/i18n/emqx_license_schema_i18n.conf index 86d25fce9..edf6ba89a 100644 --- a/lib-ee/emqx_license/i18n/emqx_license_schema_i18n.conf +++ b/lib-ee/emqx_license/i18n/emqx_license_schema_i18n.conf @@ -1,22 +1,18 @@ emqx_license_schema { license_root { desc { - en: """ - EMQX Enterprise license. - A license is either a `key` or a `file`. - When `key` and `file` are both configured, `key` is used. - - EMQX comes with a default trial license. For production use, please - visit https://www.emqx.com/apply-licenses/emqx to apply. - """ - zh: """ - EMQX企业许可证。 - 许可证是一个 `key` 或一个 `file`。 - 当 `key` 和 `file` 同时被配置时,优先使用 `key`。 - - EMQX 自带一个默认的试用许可证,若需要在生产环境部署, - 请访问 https://www.emqx.com/apply-licenses/emqx 来申请。 - """ + 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"