mike-jumper commented on code in PR #717:
URL: https://github.com/apache/guacamole-client/pull/717#discussion_r932750256


##########
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:
   Whoops - hey there, @jbpaux.
   
   If `/bin/bash` is already available, then that seems by far the best 
solution. Really anything that avoids having to manually list each mapping of 
old/new var would be really nice. To me, the important thing is to avoid having 
such a large, manually-maintained list of ifs.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to