From 39c18ee9bf1ae07fc490182977e8c9b3d690d411 Mon Sep 17 00:00:00 2001 From: Luke Else Date: Wed, 9 Feb 2022 20:41:39 +0000 Subject: [PATCH] Updated NavdataModel and RouteController to user environment Variables --- Controllers/RouteController.cs | 3 ++- Models/NavdataModel.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Controllers/RouteController.cs b/Controllers/RouteController.cs index cadc7d7..602be30 100644 --- a/Controllers/RouteController.cs +++ b/Controllers/RouteController.cs @@ -132,7 +132,8 @@ namespace EFB.Controllers headerData.Add("referer", "luke-else.co.uk"); Dictionary formData = new Dictionary(); - formData.Add("token", ""); + + formData.Add("token", Environment.GetEnvironmentVariable("ChartFoxAPIKey", EnvironmentVariableTarget.User)); var body = new FormUrlEncodedContent(formData); //make Charts request diff --git a/Models/NavdataModel.cs b/Models/NavdataModel.cs index 90a0bb8..c439101 100644 --- a/Models/NavdataModel.cs +++ b/Models/NavdataModel.cs @@ -39,7 +39,8 @@ namespace EFB.Models } public static async Task Populate(){ - MySqlConnection con = new MySqlConnection("server=server.luke-else.co.uk;userid=root;password=;database=EFB"); + string password = Environment.GetEnvironmentVariable("MySQLPassword", EnvironmentVariableTarget.User); + MySqlConnection con = new MySqlConnection($"server=server.luke-else.co.uk;userid=root;password={password};database=EFB"); con.Open(); // Console.WriteLine($"MySQL version : {con.ServerVersion}");