diff --git a/Controllers/HomeController.cs b/Controllers/HomeController.cs index a44cafd..5a3081e 100644 --- a/Controllers/HomeController.cs +++ b/Controllers/HomeController.cs @@ -55,7 +55,7 @@ namespace CarCareTracker.Controllers { try { - var configFileContents = System.IO.File.ReadAllText("userConfig.json"); + var configFileContents = System.IO.File.ReadAllText("userconfig/userConfig.json"); var existingUserConfig = System.Text.Json.JsonSerializer.Deserialize(configFileContents); if (existingUserConfig is not null) { @@ -69,7 +69,7 @@ namespace CarCareTracker.Controllers userConfig.UserNameHash = string.Empty; userConfig.UserPasswordHash = string.Empty; } - System.IO.File.WriteAllText("userConfig.json", System.Text.Json.JsonSerializer.Serialize(userConfig)); + System.IO.File.WriteAllText("userconfig/userConfig.json", System.Text.Json.JsonSerializer.Serialize(userConfig)); return Json(true); } catch (Exception ex) { diff --git a/Controllers/LoginController.cs b/Controllers/LoginController.cs index 6a18601..87c7f0e 100644 --- a/Controllers/LoginController.cs +++ b/Controllers/LoginController.cs @@ -36,7 +36,7 @@ namespace CarCareTracker.Controllers //compare it against hashed credentials try { - var configFileContents = System.IO.File.ReadAllText("userConfig.json"); + var configFileContents = System.IO.File.ReadAllText("userconfig/userConfig.json"); var existingUserConfig = System.Text.Json.JsonSerializer.Deserialize(configFileContents); if (existingUserConfig is not null) { @@ -74,7 +74,7 @@ namespace CarCareTracker.Controllers { try { - var configFileContents = System.IO.File.ReadAllText("userConfig.json"); + var configFileContents = System.IO.File.ReadAllText("userconfig/userConfig.json"); var existingUserConfig = JsonSerializer.Deserialize(configFileContents); if (existingUserConfig is not null) { @@ -86,7 +86,7 @@ namespace CarCareTracker.Controllers existingUserConfig.UserNameHash = hashedUserName; existingUserConfig.UserPasswordHash = hashedPassword; } - System.IO.File.WriteAllText("userConfig.json", JsonSerializer.Serialize(existingUserConfig)); + System.IO.File.WriteAllText("userconfig/userConfig.json", JsonSerializer.Serialize(existingUserConfig)); return Json(true); } catch (Exception ex) @@ -101,7 +101,7 @@ namespace CarCareTracker.Controllers { try { - var configFileContents = System.IO.File.ReadAllText("userConfig.json"); + var configFileContents = System.IO.File.ReadAllText("userconfig/userConfig.json"); var existingUserConfig = JsonSerializer.Deserialize(configFileContents); if (existingUserConfig is not null) { @@ -110,7 +110,7 @@ namespace CarCareTracker.Controllers existingUserConfig.UserNameHash = string.Empty; existingUserConfig.UserPasswordHash = string.Empty; } - System.IO.File.WriteAllText("userConfig.json", JsonSerializer.Serialize(existingUserConfig)); + System.IO.File.WriteAllText("userconfig/userConfig.json", JsonSerializer.Serialize(existingUserConfig)); //destroy any login cookies. Response.Cookies.Delete("ACCESS_TOKEN"); return Json(true); diff --git a/Program.cs b/Program.cs index d485dba..7a26430 100644 --- a/Program.cs +++ b/Program.cs @@ -23,7 +23,7 @@ if (!Directory.Exists("data")) } //Additional JsonFile -builder.Configuration.AddJsonFile("userConfig.json", optional: true, reloadOnChange: true); +builder.Configuration.AddJsonFile("userconfig/userConfig.json", optional: true, reloadOnChange: true); //Configure Auth builder.Services.AddDataProtection(); diff --git a/docker-compose.yaml b/docker-compose.yaml index 715e428..f15209d 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -14,4 +14,7 @@ services: type: bind - source: path\to\documents target: /App/wwwroot/documents + type: bind + - source: path\to\userconfig + target: /App/userconfig type: bind \ No newline at end of file diff --git a/userConfig.json b/userconfig/userConfig.json similarity index 100% rename from userConfig.json rename to userconfig/userConfig.json