From 9128e41bcbceaad1112152715913cfd9f078a98f Mon Sep 17 00:00:00 2001 From: Joseph Milazzo Date: Sat, 10 May 2025 13:41:35 -0500 Subject: [PATCH] On first startup (non-docker), rename appsettings-init -> appsettings. Fixed accidently packing cached files with the build. --- API/API.csproj | 11 +++++------ API/Program.cs | 11 +++++++++++ build.sh | 4 +++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/API/API.csproj b/API/API.csproj index 0f8c99c3c..f9a889d74 100644 --- a/API/API.csproj +++ b/API/API.csproj @@ -111,17 +111,16 @@ - - - - - + + + + @@ -139,6 +138,7 @@ + @@ -188,7 +188,6 @@ - Always diff --git a/API/Program.cs b/API/Program.cs index 852844f2f..71456cd0c 100644 --- a/API/Program.cs +++ b/API/Program.cs @@ -1,4 +1,5 @@ using System; +using System.IO; using System.IO.Abstractions; using System.Linq; using System.Security.Cryptography; @@ -48,6 +49,16 @@ public class Program var directoryService = new DirectoryService(null!, new FileSystem()); + + // Check if this is the first time running and if so, rename appsettings-init.json to appsettings.json + var firstRunConfigFilePath = Path.Join(Directory.GetCurrentDirectory(), "config/appsettings-init.json"); + if (File.Exists(firstRunConfigFilePath) && + !File.Exists(Path.Join(Directory.GetCurrentDirectory(), "config/appsettings.json"))) + { + File.Move(firstRunConfigFilePath, Path.Join(Directory.GetCurrentDirectory(), "config/appsettings.json")); + } + + // Before anything, check if JWT has been generated properly or if user still has default if (!Configuration.CheckIfJwtTokenSet() && Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") != Environments.Development) diff --git a/build.sh b/build.sh index 673620e3b..b1b739af4 100755 --- a/build.sh +++ b/build.sh @@ -94,9 +94,11 @@ Package() fi echo "Copying appsettings.json" - cp config/appsettings.json $lOutputFolder/config/appsettings.json + cp config/appsettings.json $lOutputFolder/config/appsettings-init.json echo "Removing appsettings.Development.json" rm $lOutputFolder/config/appsettings.Development.json + echo "Removing appsettings.json" + rm $lOutputFolder/config/appsettings.json echo "Creating tar" cd ../$outputFolder/"$runtime"/