You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by GitBox <gi...@apache.org> on 2022/05/05 22:38:12 UTC

[GitHub] [guacamole-client] jbpaux commented on a diff in pull request #717: GUACAMOLE-1572: Match environment variables for POSTGRESQL auth plugin doesn't match guacamole.properties variable name

jbpaux commented on code in PR #717:
URL: https://github.com/apache/guacamole-client/pull/717#discussion_r866363420


##########
guacamole-docker/bin/start.sh:
##########
@@ -251,40 +251,97 @@ environment variables or their corresponding Docker secrets by appending _FILE
 to the environment variable, and setting the value to the path of the
 corresponding secret:
 
-    POSTGRES_USER      The user to authenticate as when connecting to
+    POSTGRESQL_USER      The user to authenticate as when connecting to
                        PostgreSQL.
 
-    POSTGRES_PASSWORD  The password to use when authenticating with PostgreSQL
-                       as POSTGRES_USER.
+    POSTGRESQL_PASSWORD  The password to use when authenticating with PostgreSQL
+                       as POSTGRESQL_USER.
 
-    POSTGRES_DATABASE  The name of the PostgreSQL database to use for Guacamole
+    POSTGRESQL_DATABASE  The name of the PostgreSQL database to use for Guacamole
                        authentication.
 END
     exit 1;
 }
 
+## Provide backward compatibility on POSTGRES_* environment variables
+## In case of new deployment, please use POSTGRESQL_* equivalent variables.
+if [ -n "$POSTGRES_HOSTNAME" ]; then
+    POSTGRESQL_HOSTNAME=$POSTGRES_HOSTNAME;
+fi
+if [ -n "$POSTGRES_PORT" ]; then
+    POSTGRESQL_PORT=$POSTGRES_PORT;
+fi
+if [ -n "$POSTGRES_DATABASE" ]; then
+    POSTGRESQL_DATABASE=$POSTGRES_DATABASE;
+fi
+if [ -n "$POSTGRES_DATABASE_FILE" ]; then
+    POSTGRESQL_DATABASE=$POSTGRES_DATABASE_FILE;
+fi
+if [ -n "$POSTGRES_USER_FILE" ]; then
+    POSTGRESQL_USER_FILE=$POSTGRES_USER_FILE;
+fi
+if [ -n "$POSTGRES_USER" ]; then
+    POSTGRESQL_USER=$POSTGRES_USER;
+fi
+if [ -n "$POSTGRES_PASSWORD_FILE" ]; then
+    POSTGRESQL_PASSWORD_FILE=$POSTGRES_PASSWORD_FILE;
+fi
+if [ -n "$POSTGRES_PASSWORD" ]; then
+    POSTGRESQL_PASSWORD=$POSTGRES_PASSWORD;
+fi
+if [ -n "$POSTGRES_ABSOLUTE_MAX_CONNECTIONS" ]; then
+    POSTGRESQL_ABSOLUTE_MAX_CONNECTIONS=$POSTGRES_ABSOLUTE_MAX_CONNECTIONS;
+fi
+if [ -n "$POSTGRES_DEFAULT_MAX_CONNECTIONS" ]; then
+    POSTGRESQL_DEFAULT_MAX_CONNECTIONS=$POSTGRES_DEFAULT_MAX_CONNECTIONS;
+fi
+if [ -n "$POSTGRES_DEFAULT_MAX_GROUP_CONNECTIONS" ]; then
+    POSTGRESQL_DEFAULT_MAX_GROUP_CONNECTIONS=$POSTGRES_DEFAULT_MAX_GROUP_CONNECTIONS;
+fi
+if [ -n "$POSTGRES_DEFAULT_MAX_CONNECTIONS_PER_USER" ]; then
+    POSTGRESQL_DEFAULT_MAX_CONNECTIONS_PER_USER=$POSTGRES_DEFAULT_MAX_CONNECTIONS_PER_USER;
+fi
+if [ -n "$POSTGRES_DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER" ]; then
+    POSTGRESQL_DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER=$POSTGRES_DEFAULT_MAX_GROUP_CONNECTIONS_PER_USER;
+fi
+if [ -n "$POSTGRES_DEFAULT_STATEMENT_TIMEOUT" ]; then
+    POSTGRESQL_DEFAULT_STATEMENT_TIMEOUT=$POSTGRES_DEFAULT_STATEMENT_TIMEOUT;
+fi
+if [ -n "$POSTGRES_USER_REQUIRED" ]; then
+    POSTGRESQL_USER_REQUIRED=$POSTGRES_USER_REQUIRED;
+fi
+if [ -n "$POSTGRES_SOCKET_TIMEOUT" ]; then
+    POSTGRESQL_SOCKET_TIMEOUT=$POSTGRES_SOCKET_TIMEOUT;
+fi
+if [ -n "$POSTGRES_SSL_KEY_PASSWORD_FILE" ]; then
+    POSTGRESQL_SSL_KEY_PASSWORD_FILE=$POSTGRES_SSL_KEY_PASSWORD_FILE;
+fi
+if [ -n "$POSTGRES_SSL_KEY_PASSWORD" ]; then
+    POSTGRESQL_SSL_KEY_PASSWORD=$POSTGRES_SSL_KEY_PASSWORD;
+fi

Review Comment:
   I thought of that but do we assume `printf -v` is available ? `/bin/sh` is used and I wasn't sure it was ok.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org