From 77fca3117444c6d784e06e33eef8a782ddf97bd7 Mon Sep 17 00:00:00 2001 From: JimMoen Date: Mon, 6 May 2024 10:59:58 +0800 Subject: [PATCH 1/7] feat: bump avsc and i18n example files --- priv/config_i18n.json.example | 74 +++++++++++++++++ priv/config_schema.avsc.example | 141 ++++++++++++++++++++++++++++++++ 2 files changed, 215 insertions(+) create mode 100644 priv/config_i18n.json.example create mode 100644 priv/config_schema.avsc.example diff --git a/priv/config_i18n.json.example b/priv/config_i18n.json.example new file mode 100644 index 00000000..b474db7c --- /dev/null +++ b/priv/config_i18n.json.example @@ -0,0 +1,74 @@ +{ + "$hostname_label": { + "zh": "主机名", + "en": "Hostname" + }, + "$hostname_desc": { + "zh": "主机名是一个标识符,用于识别网络上的设备。主机名通常是一个域名,例如:www.example.com。", + "en": "The hostname is an identifier used to identify devices on a network. The hostname is usually a domain name, such as www.example.com." + }, + "$hostname_validate": { + "zh": "主机名必须是一个有效的域名。", + "en": "The hostname must be a valid domain name." + }, + "$port_label": { + "zh": "端口", + "en": "Port" + }, + "$port_desc": { + "zh": "端口是一个数字,用于标识网络上的服务。常见的端口有:80(HTTP)、443(HTTPS)、21(FTP)。", + "en": "The port is a number used to identify services on a network. Common ports include: 80 (HTTP), 443 (HTTPS), 21 (FTP)." + }, + "$port_range_validate": { + "zh": "端口必须在 1 到 65535 之间。", + "en": "The port must be between 1 and 65535." + }, + "$connection_options_label": { + "en": "Connection Options", + "zh": "连接选项" + }, + "$connection_options_desc": { + "en": "A list of additional options for the database connection.", + "zh": "数据库连接的附加选项列表。" + }, + "$username_label": { + "en": "Username", + "zh": "用户名" + }, + "$username_desc": { + "zh": "连接数据库的用户名", + "en": "The username used to connect to the database." + }, + "$password_label": { + "en": "Password", + "zh": "密码" + }, + "$password_desc": { + "en": "The password used to connect to the database.", + "zh": "连接数据库的密码。" + }, + "$password_length_validate": { + "en": "The password must be at least 8 characters long.", + "zh": "密码长度必须至少为 8 个字符。" + }, + "$password_validate": { + "en": "The password must contain at least one uppercase letter, one lowercase letter, one number, and one special character.", + "zh": "密码必须包含至少一个大写字母、一个小写字母、一个数字和一个特殊字符。" + }, + "$option_name_label": { + "en": "Option Name", + "zh": "选项名称" + }, + "$option_name_desc": { + "en": "The name of the connection option.", + "zh": "连接选项的名称。" + }, + "$option_value_label": { + "en": "Option Value", + "zh": "选项值" + }, + "$option_value_desc": { + "en": "The value of the connection option.", + "zh": "连接选项的值。" + } +} diff --git a/priv/config_schema.avsc.example b/priv/config_schema.avsc.example new file mode 100644 index 00000000..73ac29b5 --- /dev/null +++ b/priv/config_schema.avsc.example @@ -0,0 +1,141 @@ +{ + "type": "record", + "name": "ExtendedConfig", + "fields": [ + { + "name": "hostname", + "type": "string", + "default": "localhost", + "$ui": { + "component": "input", + "flex": 12, + "required": true, + "label": "$hostname_label", + "description": "$hostname_desc", + "rules": [ + { + "type": "pattern", + "pattern": "^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])(\\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9]))*$", + "message": "$hostname_validate" + } + ] + } + }, + { + "name": "port", + "type": "int", + "default": 3306, + "$ui": { + "component": "input-number", + "flex": 12, + "required": true, + "label": "$port_label", + "description": "$port_desc", + "rules": [ + { + "type": "range", + "min": 1, + "max": 65535, + "message": "$port_range_validate" + } + ] + } + }, + { + "name": "connectionOptions", + "type": { + "type": "array", + "items": { + "type": "record", + "name": "ConnectionOption", + "fields": [ + { + "name": "optionName", + "type": "string" + }, + { + "name": "optionValue", + "type": "string" + }, + { + "name": "optionType", + "type": "string" + } + ] + } + }, + "default": [ + { + "optionName": "autoReconnect", + "optionValue": "true", + "optionType": "string" + } + ], + "$ui": { + "component": "maps-editor", + "flex": 24, + "items": { + "optionName": { + "label": "$option_name_label", + "description": "$option_name_desc", + "type": "string" + }, + "optionValue": { + "label": "$option_value_label", + "description": "$option_value_desc", + "type": "string" + } + }, + "label": "$connection_options_label", + "description": "$connection_options_desc" + } + }, + { + "name": "auth", + "type": { + "type": "record", + "name": "authConfigs", + "fields": [ + { + "name": "username", + "type": "string", + "$ui": { + "component": "input", + "flex": 12, + "required": true, + "label": "$username_label", + "description": "$username_desc" + } + }, + { + "name": "password", + "type": [ + "null", + "string" + ], + "default": null, + "$ui": { + "component": "input-password", + "flex": 12, + "label": "$password_label", + "description": "$password_desc", + "rules": [ + { + "type": "length", + "minLength": 8, + "maxLength": 128, + "message": "$password_length_validate" + }, + { + "type": "pattern", + "pattern": "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d]*$", + "message": "$password_validate" + } + ] + } + } + ] + } + } + ] +} From 5b08c232938a4b382e16b7698f77ba1734fe955d Mon Sep 17 00:00:00 2001 From: JimMoen Date: Mon, 6 May 2024 15:01:00 +0800 Subject: [PATCH 2/7] docs: improve README.md --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ce8be3a2..1cffcaef 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,9 @@ This is a [rebar3 template](https://rebar3.org/docs/tutorials/templates/#custom- This plugin template is for EMQX >= 5.0. +We introduced a AVRO config schema mechanism for plugins in EMQX 5.7.0 to facilitate configuration updates for plugins at runtime via RESTAPI. +Please see [priv/config_schmea.avsc.example](./priv/config_schmea.avsc.example) and [priv/config_i18n.json.example](./priv/config_schmea.avsc.example) as examples. + For EMQX >= 4.3, please see branch emqx-v4 For older EMQX versions, plugin development is no longer maintained. @@ -27,9 +30,12 @@ $ rebar3 new emqx-plugin my_emqx_plugin $ make -C my_emqx_plugin rel ``` -**NOTE** -If the `REBAR_CACHE_DIR` environment variable has been set, the directory for templates should be `$REBAR_CACHE_DIR/.config/rebar3/templates`. -[Here](https://github.com/erlang/rebar3/issues/2762) is a relevant issue. +> [!NOTE] +> In order to use the AVRO config schema feature, please make sure the plugin template tag version >= 5.7.0 + +> [!NOTE] +> If the `REBAR_CACHE_DIR` environment variable has been set, the directory for templates should be `$REBAR_CACHE_DIR/.config/rebar3/templates`. +> [Here](https://github.com/erlang/rebar3/issues/2762) is a relevant issue. This will create a tarball containing your custom plugin. You can use EMQX's Dashboard or it's command line tools to deploy it into your running EMQX cluster. From bec3c93b1c19df602b35f036350642c645abc886 Mon Sep 17 00:00:00 2001 From: JimMoen Date: Mon, 6 May 2024 15:10:28 +0800 Subject: [PATCH 3/7] chore: bump vsn for rebar plugin `emqx_plugrel` --- rebar_template.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rebar_template.config b/rebar_template.config index e53c533e..dcf68e1a 100644 --- a/rebar_template.config +++ b/rebar_template.config @@ -12,7 +12,7 @@ ]}. {plugins, [ - {emqx_plugrel, {git, "https://github.com/emqx/emqx_plugrel.git", {tag, "0.3.0"}}} + {emqx_plugrel, {git, "https://github.com/emqx/emqx_plugrel.git", {tag, "0.4.1"}}} ]}. {erl_opts, [debug_info]}. From 7e288a338009b4fff0df3665379f7f71d8f6b8cb Mon Sep 17 00:00:00 2001 From: JimMoen Date: Mon, 6 May 2024 15:13:00 +0800 Subject: [PATCH 4/7] ci: bump builder image vsn --- .github/workflows/erlang.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/erlang.yml b/.github/workflows/erlang.yml index 322f9688..2e275e31 100644 --- a/.github/workflows/erlang.yml +++ b/.github/workflows/erlang.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest container: - image: ghcr.io/emqx/emqx-builder/5.3-2:1.15.7-26.2.1-2-ubuntu22.04 + image: ghcr.io/emqx/emqx-builder/5.3-5:1.15.7-26.2.1-2-ubuntu22.04 steps: - uses: actions/checkout@v2 From e2f9f86d75e16770717f2ee6e9d8fa256a23a02f Mon Sep 17 00:00:00 2001 From: JimMoen Date: Tue, 14 May 2024 16:01:35 +0800 Subject: [PATCH 5/7] build: get different rebar3 based on different OTP versions --- .tool-versions | 11 ++++++++++ Makefile | 23 +++++++++++---------- scripts/ensure-rebar3.sh | 43 ++++++++++++++++++++++++++++++++++++++++ scripts/get-otp-vsn.sh | 5 +++++ 4 files changed, 72 insertions(+), 10 deletions(-) create mode 100644 .tool-versions create mode 100755 scripts/ensure-rebar3.sh create mode 100755 scripts/get-otp-vsn.sh diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 00000000..8b619ef6 --- /dev/null +++ b/.tool-versions @@ -0,0 +1,11 @@ +## The Official Releases using OTP 26 since EMQX v5.5.0 +## See also +## https://github.com/emqx/emqx/releases/tag/v5.5.0 +# erlang 26.2.1-2 +# elixir 1.15.7-otp-26 + +## Keep using OTP 25.3.2 for docker image +## see also +## https://github.com/emqx/emqx/blob/v5.6.0/build#L400-L401 +erlang 25.3.2-2 +elixir 1.15.7-otp-25 diff --git a/Makefile b/Makefile index 5e850224..3129d25a 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,25 @@ +export BUILD_WITHOUT_QUIC ?= true +export BUILD_WITHOUT_ROCKSDB ?= true + ## shallow clone for speed +export REBAR_GIT_CLONE_OPTIONS += --depth=1 -BUILD_WITHOUT_QUIC ?= true -export BUILD_WITHOUT_QUIC -BUILD_WITHOUT_ROCKSDB ?= true -export BUILD_WITHOUT_ROCKSDB +## Feature Used in rebar plugin emqx_plugrel +## The Feature have not enabled by default on OTP25 +export ERL_FLAGS ?= -enable-feature maybe_expr -REBAR ?= $(or $(shell which rebar3 2>/dev/null),$(CURDIR)/rebar3) -REBAR_VERSION ?= 3.19.0-emqx-1 +REBAR = $(CURDIR)/rebar3 +SCRIPTS = $(CURDIR)/scripts .PHONY: all all: compile -.PHONY: get-rebar3 -get-rebar3: - @$(CURDIR)/get-rebar3 $(REBAR_VERSION) +.PHONY: ensure-rebar3 +ensure-rebar3: + @$(SCRIPTS)/ensure-rebar3.sh $(REBAR): - $(MAKE) get-rebar3 + $(MAKE) ensure-rebar3 .PHONY: compile compile: $(REBAR) diff --git a/scripts/ensure-rebar3.sh b/scripts/ensure-rebar3.sh new file mode 100755 index 00000000..14b6ad7c --- /dev/null +++ b/scripts/ensure-rebar3.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +set -euo pipefail + +[ "${DEBUG:-0}" -eq 1 ] && set -x + +OTP_VSN="${OTP_VSN:-$(./scripts/get-otp-vsn.sh)}" +case ${OTP_VSN} in + 25*) + VERSION="3.19.0-emqx-9" + ;; + 26*) + VERSION="3.20.0-emqx-1" + ;; + *) + echo "Unsupported Erlang/OTP version $OTP_VSN" + exit 1 + ;; +esac + +# ensure dir +cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/.." + +DOWNLOAD_URL='https://github.com/emqx/rebar3/releases/download' + +download() { + echo "downloading rebar3 ${VERSION}" + curl -f -L "${DOWNLOAD_URL}/${VERSION}/rebar3" -o ./rebar3 +} + +# get the version number from the second line of the escript +# because command `rebar3 -v` tries to load rebar.config +# which is slow and may print some logs +version() { + head -n 2 ./rebar3 | tail -n 1 | tr ' ' '\n' | grep -E '^.+-emqx-.+' +} + +if [ -f 'rebar3' ] && [ "$(version)" = "$VERSION" ]; then + exit 0 +fi + +download +chmod +x ./rebar3 diff --git a/scripts/get-otp-vsn.sh b/scripts/get-otp-vsn.sh new file mode 100755 index 00000000..d21e2c83 --- /dev/null +++ b/scripts/get-otp-vsn.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -euo pipefail + +erl -noshell -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' From 4333ab5af89cbf236c3f111c5fd11936d47aa517 Mon Sep 17 00:00:00 2001 From: JimMoen Date: Mon, 6 May 2024 10:59:37 +0800 Subject: [PATCH 6/7] fix: config.hocon.enterprise.example for plugin and bump template file --- README.md | 5 +- README_template.md | 1 + emqx-plugin.template | 17 ++- priv/config.hocon | 4 - priv/config.hocon.example | 20 +++ priv/config_schema.avsc.enterprise.example | 141 +++++++++++++++++++++ priv/config_schema.avsc.example | 85 +------------ rebar_template.config | 2 +- 8 files changed, 186 insertions(+), 89 deletions(-) delete mode 100644 priv/config.hocon create mode 100644 priv/config.hocon.example create mode 100644 priv/config_schema.avsc.enterprise.example diff --git a/README.md b/README.md index 1cffcaef..61b67ef0 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,8 @@ A plugin template for Elixir (experimental) can be found at https://github.com/e ## Prerequisites + A working build environment (eg `build_essential`) including `make` - + Erlang OTP 25 or newer recommended + + ASDF tool-chains recommended to manage EMQX released Erlang/OTP. + + **MUST** use OTP 25 For docker image deployment. See also [./.tool-versions](./.tool-versions) and [EMQX Release v5.5.0](https://github.com/emqx/emqx/releases/tag/v5.5.0). + rebar3 ## Usage @@ -32,6 +33,8 @@ $ make -C my_emqx_plugin rel > [!NOTE] > In order to use the AVRO config schema feature, please make sure the plugin template tag version >= 5.7.0 +> Rename files in the `./priv` directory to ensure that EMQX can load them correctly after the plugin is installed. +> See also [EMQX Documents - Plugins](https://www.emqx.io/docs/en/latest/extensions/plugins.html) for more detail. > [!NOTE] > If the `REBAR_CACHE_DIR` environment variable has been set, the directory for templates should be `$REBAR_CACHE_DIR/.config/rebar3/templates`. diff --git a/README_template.md b/README_template.md index ad35d090..8c5a2562 100644 --- a/README_template.md +++ b/README_template.md @@ -9,6 +9,7 @@ An EMQX plugin release is a tar file including including a subdirectory of this 1. A JSON format metadata file describing the plugin 2. Versioned directories for all applications needed for this plugin (source and binaries). +3. Confirm the OTP version used by EMQX that the plugin will be installed on (See also [./.tool-versions](./.tool-versions)). In a shell from this plugin's working directory execute `make rel` to have the package created like: diff --git a/emqx-plugin.template b/emqx-plugin.template index 6ef47b41..5060e6ad 100644 --- a/emqx-plugin.template +++ b/emqx-plugin.template @@ -3,20 +3,29 @@ {description, "Another amazing EMQX plugin."}, {version, "1.0.0", "The release version of this plugin."}, {app_vsn, "0.1.0", "The erlang application vsn value."}, - {emqx_vsn, "v5.4.1", "EMQX version to use as a dependency."}, + {emqx_vsn, "v5.6.1", "EMQX version to use as a dependency."}, {license, "Apache-2.0", "Short identifier for license you want to distribute this plugin under."}, {author_website, "http://example.com", "A website with details about the author."}, {repo, "https://github.com/emqx/emqx-plugin-template", "Where to find the source code for this plugin."} ]}. {dir, "{{name}}/src"}. {dir, "{{name}}/priv"}. +{dir, "{{name}}/scripts"}. +{file, ".tool-versions", "{{name}}/.tool-versions"}. {file, "LICENSE", "{{name}}/LICENSE"}. {file, "Makefile", "{{name}}/Makefile"}. {file, "erlang_ls.config", "{{name}}/erlang_ls.config"}. -{file, "get-rebar3", "{{name}}/get-rebar3"}. -{file, "priv/config.hocon", "{{name}}/priv/config.hocon"}. + +{file, "priv/config.hocon.example", "{{name}}/priv/config.hocon.example"}. +{file, "priv/config_schema.avsc.enterprise.example", "{{name}}/priv/config_schema.avsc.enterprise.example"}. +{file, "priv/config_schema.avsc.example", "{{name}}/priv/config_schema.avsc.example"}. +{file, "priv/config_i18n.json.example", "{{name}}/priv/config_i18n.json.example"}. + +{file, "scripts/ensure-rebar3.sh", "{{name}}/scripts/ensure-rebar3.sh"}. +{file, "scripts/get-otp-vsn.sh", "{{name}}/scripts/get-otp-vsn.sh"}. {file, "gitignore_template", "{{name}}/.gitignore"}. -{chmod, "{{name}}/get-rebar3", 8#755}. +{chmod, "{{name}}/scripts/ensure-rebar3.sh", 8#755}. +{chmod, "{{name}}/scripts/get-otp-vsn.sh", 8#755}. {template, "README_template.md", "{{name}}/README.md"}. {template, "rebar_template.config", "{{name}}/rebar.config"}. {template, "src/emqx_plugin_template.app.src", "{{name}}/src/{{name}}.app.src"}. diff --git a/priv/config.hocon b/priv/config.hocon deleted file mode 100644 index 52328f74..00000000 --- a/priv/config.hocon +++ /dev/null @@ -1,4 +0,0 @@ -## This is a demo config in HOCON format -## The same format used by EMQX since 5.0 - -magic_n = 42 diff --git a/priv/config.hocon.example b/priv/config.hocon.example new file mode 100644 index 00000000..aac3d33c --- /dev/null +++ b/priv/config.hocon.example @@ -0,0 +1,20 @@ +## This is a demo config in HOCON format +## The same format used by EMQX since 5.0 + +hostname = "localhost" +port = 3306 + +connectionOptions = [ + { + optionName = "autoReconnect" + optionType = "string" + optionValue = "true" + } +] + +auth { + username = "admin" + password { + string = "Public123" + } +} diff --git a/priv/config_schema.avsc.enterprise.example b/priv/config_schema.avsc.enterprise.example new file mode 100644 index 00000000..851bea21 --- /dev/null +++ b/priv/config_schema.avsc.enterprise.example @@ -0,0 +1,141 @@ +{ + "type": "record", + "name": "ExtendedConfig", + "fields": [ + { + "name": "hostname", + "type": "string", + "default": "localhost", + "$ui": { + "component": "input", + "flex": 12, + "required": true, + "label": "$hostname_label", + "description": "$hostname_desc", + "rules": [ + { + "type": "pattern", + "pattern": "^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])(\\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9]))*$", + "message": "$hostname_validate" + } + ] + } + }, + { + "name": "port", + "type": "int", + "default": 3306, + "$ui": { + "component": "input-number", + "flex": 12, + "required": true, + "label": "$port_label", + "description": "$port_desc", + "rules": [ + { + "type": "range", + "min": 1, + "max": 65535, + "message": "$port_range_validate" + } + ] + } + }, + { + "name": "connectionOptions", + "type": { + "type": "array", + "items": { + "type": "record", + "name": "ConnectionOption", + "fields": [ + { + "name": "optionName", + "type": "string" + }, + { + "name": "optionValue", + "type": "string" + }, + { + "name": "optionType", + "type": "string" + } + ] + } + }, + "default": [ + { + "optionName": "autoReconnect", + "optionValue": "true", + "optionType": "boolean" + } + ], + "$ui": { + "component": "maps-editor", + "flex": 24, + "items": { + "optionName": { + "label": "$option_name_label", + "description": "$option_name_desc", + "type": "string" + }, + "optionValue": { + "label": "$option_value_label", + "description": "$option_value_desc", + "type": "string" + } + }, + "label": "$connection_options_label", + "description": "$connection_options_desc" + } + }, + { + "name": "auth", + "type": { + "type": "record", + "name": "authConfigs", + "fields": [ + { + "name": "username", + "type": "string", + "$ui": { + "component": "input", + "flex": 12, + "required": true, + "label": "$username_label", + "description": "$username_desc" + } + }, + { + "name": "password", + "type": [ + "null", + "string" + ], + "default": null, + "$ui": { + "component": "input-password", + "flex": 12, + "label": "$password_label", + "description": "$password_desc", + "rules": [ + { + "type": "length", + "minLength": 8, + "maxLength": 128, + "message": "$password_length_validate" + }, + { + "type": "pattern", + "pattern": "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d]*$", + "message": "$password_validate" + } + ] + } + } + ] + } + } + ] +} diff --git a/priv/config_schema.avsc.example b/priv/config_schema.avsc.example index 73ac29b5..a349c065 100644 --- a/priv/config_schema.avsc.example +++ b/priv/config_schema.avsc.example @@ -5,41 +5,12 @@ { "name": "hostname", "type": "string", - "default": "localhost", - "$ui": { - "component": "input", - "flex": 12, - "required": true, - "label": "$hostname_label", - "description": "$hostname_desc", - "rules": [ - { - "type": "pattern", - "pattern": "^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])(\\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9]))*$", - "message": "$hostname_validate" - } - ] - } + "default": "localhost" }, { "name": "port", "type": "int", - "default": 3306, - "$ui": { - "component": "input-number", - "flex": 12, - "required": true, - "label": "$port_label", - "description": "$port_desc", - "rules": [ - { - "type": "range", - "min": 1, - "max": 65535, - "message": "$port_range_validate" - } - ] - } + "default": 3306 }, { "name": "connectionOptions", @@ -68,27 +39,9 @@ { "optionName": "autoReconnect", "optionValue": "true", - "optionType": "string" + "optionType": "boolean" } - ], - "$ui": { - "component": "maps-editor", - "flex": 24, - "items": { - "optionName": { - "label": "$option_name_label", - "description": "$option_name_desc", - "type": "string" - }, - "optionValue": { - "label": "$option_value_label", - "description": "$option_value_desc", - "type": "string" - } - }, - "label": "$connection_options_label", - "description": "$connection_options_desc" - } + ] }, { "name": "auth", @@ -98,14 +51,7 @@ "fields": [ { "name": "username", - "type": "string", - "$ui": { - "component": "input", - "flex": 12, - "required": true, - "label": "$username_label", - "description": "$username_desc" - } + "type": "string" }, { "name": "password", @@ -113,26 +59,7 @@ "null", "string" ], - "default": null, - "$ui": { - "component": "input-password", - "flex": 12, - "label": "$password_label", - "description": "$password_desc", - "rules": [ - { - "type": "length", - "minLength": 8, - "maxLength": 128, - "message": "$password_length_validate" - }, - { - "type": "pattern", - "pattern": "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d]*$", - "message": "$password_validate" - } - ] - } + "default": null } ] } diff --git a/rebar_template.config b/rebar_template.config index dcf68e1a..16bbd0f3 100644 --- a/rebar_template.config +++ b/rebar_template.config @@ -37,7 +37,7 @@ , {repo, "@@repo@@"} , {functionality, ["Demo"]} , {compatibility, - [ {emqx, "~> 5.0"} + [ {emqx, "~> 5.7"} ]} , {description, "@@description@@"} ] From 6dc856749ebad561a8f96a2fddd5c00458b930e4 Mon Sep 17 00:00:00 2001 From: JimMoen Date: Wed, 22 May 2024 14:56:03 +0800 Subject: [PATCH 7/7] chore: bump emqx_plugrel vsn to 0.5.0 --- rebar_template.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rebar_template.config b/rebar_template.config index 16bbd0f3..fed83f0a 100644 --- a/rebar_template.config +++ b/rebar_template.config @@ -12,7 +12,7 @@ ]}. {plugins, [ - {emqx_plugrel, {git, "https://github.com/emqx/emqx_plugrel.git", {tag, "0.4.1"}}} + {emqx_plugrel, {git, "https://github.com/emqx/emqx_plugrel.git", {tag, "0.5.0"}}} ]}. {erl_opts, [debug_info]}.