From b63bba59d5aabf7cdd14c5024bb505bbabbbdf80 Mon Sep 17 00:00:00 2001 From: zhouzb Date: Wed, 30 Jun 2021 17:26:07 +0800 Subject: [PATCH] feat(authn): update schema for mysql and postgresql --- .../src/simple_authn/emqx_authn_mysql.erl | 24 ++----------------- .../src/simple_authn/emqx_authn_pgsql.erl | 22 ++--------------- 2 files changed, 4 insertions(+), 42 deletions(-) diff --git a/apps/emqx_authn/src/simple_authn/emqx_authn_mysql.erl b/apps/emqx_authn/src/simple_authn/emqx_authn_mysql.erl index 4fddcc3f7..3b5384d9c 100644 --- a/apps/emqx_authn/src/simple_authn/emqx_authn_mysql.erl +++ b/apps/emqx_authn/src/simple_authn/emqx_authn_mysql.erl @@ -33,27 +33,6 @@ %% Hocon Schema %%------------------------------------------------------------------------------ -%% Config: -%% host -%% port -%% username -%% password -%% database -%% pool_size -%% connect_timeout -%% enable_ssl -%% ssl_opts -%% cacertfile -%% certfile -%% keyfile -%% verify -%% servce_name_indication -%% tls_versions -%% ciphers -%% password_hash_algorithm -%% salt_position -%% query -%% query_timeout structs() -> [config]. fields(config) -> @@ -61,7 +40,8 @@ fields(config) -> , {salt_position, {enum, [prefix, suffix]}} , {query, fun query/1} , {query_timeout, fun query_timeout/1} - ]. + ] ++ emqx_connector_schema_lib:relational_db_fields() + ++ emqx_connector_schema_lib:ssl_fields(). password_hash_algorithm(type) -> string(); password_hash_algorithm(_) -> undefined. diff --git a/apps/emqx_authn/src/simple_authn/emqx_authn_pgsql.erl b/apps/emqx_authn/src/simple_authn/emqx_authn_pgsql.erl index 8c250e216..c9046c606 100644 --- a/apps/emqx_authn/src/simple_authn/emqx_authn_pgsql.erl +++ b/apps/emqx_authn/src/simple_authn/emqx_authn_pgsql.erl @@ -33,32 +33,14 @@ %% Hocon Schema %%------------------------------------------------------------------------------ -%% Config: -%% host -%% port -%% username -%% password -%% database -%% pool_size -%% connect_timeout -%% enable_ssl -%% cacertfile -%% certfile -%% keyfile -%% verify -%% servce_name_indication -%% tls_versions -%% ciphers -%% password_hash_algorithm -%% salt_position -%% query structs() -> [config]. fields(config) -> [ {password_hash_algorithm, fun password_hash_algorithm/1} , {salt_position, {enum, [prefix, suffix]}} , {query, fun query/1} - ]. + ] ++ emqx_connector_schema_lib:relational_db_fields() + ++ emqx_connector_schema_lib:ssl_fields(). password_hash_algorithm(type) -> string(); password_hash_algorithm(_) -> undefined.