From f8c0aa49a240b65114edb99be2f1e68401cebc56 Mon Sep 17 00:00:00 2001 From: JimMoen Date: Tue, 11 Apr 2023 09:54:58 +0800 Subject: [PATCH] style: make elvis and shellcheck happy --- .../emqx_ee_connector/src/emqx_ee_connector_sqlserver.erl | 6 ++++-- scripts/install-odbc-driver.sh | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib-ee/emqx_ee_connector/src/emqx_ee_connector_sqlserver.erl b/lib-ee/emqx_ee_connector/src/emqx_ee_connector_sqlserver.erl index 214663b22..55a5d488f 100644 --- a/lib-ee/emqx_ee_connector/src/emqx_ee_connector_sqlserver.erl +++ b/lib-ee/emqx_ee_connector/src/emqx_ee_connector_sqlserver.erl @@ -342,9 +342,11 @@ do_get_status(Conn, RequestTimeout) -> %% About the connection string attribute `Encrypt`: %% The default value is `yes` in odbc version 18.0+ and `no` in previous versions. %% And encrypted connections always verify the server's certificate. -%% So `Encrypt=YES;TrustServerCertificate=YES` must be set in the connection string when connecting to a server that has a self-signed certificate. +%% So `Encrypt=YES;TrustServerCertificate=YES` must be set in the connection string +%% when connecting to a server that has a self-signed certificate. %% See also: -%% https://learn.microsoft.com/en-us/sql/connect/odbc/dsn-connection-string-attribute?source=recommendations&view=sql-server-ver16#encrypt +%% 'https://learn.microsoft.com/en-us/sql/connect/odbc/ +%% dsn-connection-string-attribute?source=recommendations&view=sql-server-ver16#encrypt' conn_str([], Acc) -> %% we should use this for msodbcsql 18+ %% lists:join(";", ["Encrypt=YES", "TrustServerCertificate=YES" | Acc]); diff --git a/scripts/install-odbc-driver.sh b/scripts/install-odbc-driver.sh index 4ca71d88d..7ceab95a0 100755 --- a/scripts/install-odbc-driver.sh +++ b/scripts/install-odbc-driver.sh @@ -5,14 +5,15 @@ set -euo pipefail # install msodbcsql17 -if ! [[ "16.04 18.04 20.04 22.04" == *"$(lsb_release -rs)"* ]]; +VERSION=$(lsb_release -rs) +if ! [[ "16.04 18.04 20.04 22.04" == *"$VERSION"* ]]; then - echo "Ubuntu $(lsb_release -rs) is not currently supported."; + echo "Ubuntu $VERSION is not currently supported."; exit 1; fi curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \ -curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list > /etc/apt/sources.list.d/mssql-release.list && \ +curl https://packages.microsoft.com/config/ubuntu/"$VERSION"/prod.list > /etc/apt/sources.list.d/mssql-release.list && \ ## TODO: upgrade builder image apt-get update && \ ACCEPT_EULA=Y apt-get install -y msodbcsql17 unixodbc-dev mssql-tools && \