aboutsummaryrefslogtreecommitdiff
path: root/devtools
diff options
context:
space:
mode:
authorMarwan Sulaiman <marwan.sameer@gmail.com>2021-12-03 23:18:02 -0500
committerJamal Carvalho <jamal@golang.org>2022-01-31 18:16:18 +0000
commitb7b7129ed82f18b0d4e41badd47a400ba051beef (patch)
treea21afa681cf7fcfcd0fd483ad902775a6c7deed6 /devtools
parent2f9bfc14a2392e0dca9eff54997817584fa7f92e (diff)
downloadgo-x-pkgsite-b7b7129ed82f18b0d4e41badd47a400ba051beef.tar.xz
pkgsite/internal/config: parameterize Postgres sslmode
This CL adds a new GO_DISCOVERY_DATABASE_SSL environment variable so that the sslmode in a Postgres database can be configured. It defaults to "disable" to ensure backwards compatibility. Fixes golang/go#49977 Change-Id: I399e32f1a7862c55c7923bc55f465e16b9a5659b Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/369314 Trust: Jamal Carvalho <jamal@golang.org> Run-TryBot: Jamal Carvalho <jamal@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com>
Diffstat (limited to 'devtools')
-rwxr-xr-xdevtools/migrate_db.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/devtools/migrate_db.sh b/devtools/migrate_db.sh
index e47b1061..b4a6d267 100755
--- a/devtools/migrate_db.sh
+++ b/devtools/migrate_db.sh
@@ -28,6 +28,10 @@ database_name='discovery-db'
if [[ $GO_DISCOVERY_DATABASE_NAME != "" ]]; then
database_name=$GO_DISCOVERY_DATABASE_NAME
fi
+ssl_mode='disable'
+if [[ $GO_DISCOVERY_DATABASE_SSL != "" ]]; then
+ ssl_mode=$GO_DISCOVERY_DATABASE_SSL
+fi
# Redirect stderr to stdout because migrate outputs to stderr, and we want
# to be able to use ordinary output redirection.
@@ -35,7 +39,7 @@ case "$1" in
up|down|force|version)
migrate \
-source file:migrations \
- -database "postgresql://$database_user:$database_password@$database_host:5432/$database_name?sslmode=disable" \
+ -database "postgresql://$database_user:$database_password@$database_host:5432/$database_name?sslmode=$ssl_mode" \
"$@" 2>&1
;;
*)