From b55d086c9ebc096c7fb0b9d8c1ec28959919a6f4 Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Thu, 25 May 2023 16:57:47 -0400 Subject: [PATCH] [PM-294] Add Database to MSSQL Environment File (#2962) --- util/MsSql/entrypoint.sh | 4 ++-- util/Setup/EnvironmentFileBuilder.cs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/util/MsSql/entrypoint.sh b/util/MsSql/entrypoint.sh index 141320059..309bf4d0e 100644 --- a/util/MsSql/entrypoint.sh +++ b/util/MsSql/entrypoint.sh @@ -43,8 +43,8 @@ fi # Replace database name in backup-db.sql if [ ! -z "$DATABASE" ] then - sed -i -e "/@DatabaseName /s/vault/$DATABASE/" backup-db.sql - sed -i -e "/@DatabaseNameSafe /s/vault/${DATABASE// /-}/" backup-db.sql + sed -i "/^SET @DatabaseName =/s/'[^']*'/'$DATABASE'/" backup-db.sql + sed -i "/^SET @DatabaseNameSafe =/s/'[^']*'/'${DATABASE// /-}'/" backup-db.sql fi # The rest... diff --git a/util/Setup/EnvironmentFileBuilder.cs b/util/Setup/EnvironmentFileBuilder.cs index 1a5fc308f..bba418085 100644 --- a/util/Setup/EnvironmentFileBuilder.cs +++ b/util/Setup/EnvironmentFileBuilder.cs @@ -104,6 +104,7 @@ public class EnvironmentFileBuilder _mssqlOverrideValues = new Dictionary { ["SA_PASSWORD"] = dbPassword, + ["DATABASE"] = _context.Install?.Database ?? "vault" }; _keyConnectorOverrideValues = new Dictionary