diff --git a/source/jaindb/Controllers/HomeController.cs b/source/jaindb/Controllers/HomeController.cs index b96697d..5572591 100644 --- a/source/jaindb/Controllers/HomeController.cs +++ b/source/jaindb/Controllers/HomeController.cs @@ -99,7 +99,10 @@ public string GetPS() if (System.IO.File.Exists("/app/wwwroot/inventory.ps1")) { string sFile = System.IO.File.ReadAllText("/app/wwwroot/inventory.ps1"); - sResult = sFile.Replace("%LocalURL%", Environment.GetEnvironmentVariable("localURL")).Replace("%WebPort%", Environment.GetEnvironmentVariable("WebPort")); + if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WebPort"))) + sResult = sFile.Replace("%LocalURL%", Environment.GetEnvironmentVariable("localURL")).Replace(":%WebPort%", ""); + else + sResult = sFile.Replace("%LocalURL%", Environment.GetEnvironmentVariable("localURL")).Replace("%WebPort%", Environment.GetEnvironmentVariable("WebPort")); //Cache result in Memory if (!string.IsNullOrEmpty(sResult)) @@ -115,7 +118,10 @@ public string GetPS() if (System.IO.File.Exists(sCurrDir + "/wwwroot/inventory.ps1")) { string sFile = System.IO.File.ReadAllText(sCurrDir + "/wwwroot/inventory.ps1"); - sResult = sFile.Replace("%LocalURL%", Environment.GetEnvironmentVariable("localURL")).Replace("%WebPort%", Environment.GetEnvironmentVariable("WebPort")); + if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WebPort"))) + sResult = sFile.Replace("%LocalURL%", Environment.GetEnvironmentVariable("localURL")).Replace(":%WebPort%", ""); + else + sResult = sFile.Replace("%LocalURL%", Environment.GetEnvironmentVariable("localURL")).Replace("%WebPort%", Environment.GetEnvironmentVariable("WebPort")); //Cache result in Memory if (!string.IsNullOrEmpty(sResult)) diff --git a/source/jaindb/Dockerfile b/source/jaindb/Dockerfile index 04cd44c..bcc126d 100644 --- a/source/jaindb/Dockerfile +++ b/source/jaindb/Dockerfile @@ -34,3 +34,5 @@ ENV UseRedis 1 ENV UseCosmosDB 0 ENV UseFileSystem 0 ENV StartDelay 3000 +ENV ReportUser = "DEMO" +ENV ReportPW = "password" diff --git a/source/jaindb/Properties/launchSettings.json b/source/jaindb/Properties/launchSettings.json index 4a3e287..ca1ff6e 100644 --- a/source/jaindb/Properties/launchSettings.json +++ b/source/jaindb/Properties/launchSettings.json @@ -19,7 +19,10 @@ "commandName": "Project", "launchBrowser": true, "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "localURL": "https://jaindb.azurewebsites.net", + "ReportPW": "password", + "ASPNETCORE_ENVIRONMENT": "Development", + "ReportUser": "DEMO" }, "applicationUrl": "http://localhost:59345/" } diff --git a/source/jaindb/Startup.cs b/source/jaindb/Startup.cs index acf4fdd..f2d2495 100644 --- a/source/jaindb/Startup.cs +++ b/source/jaindb/Startup.cs @@ -142,14 +142,18 @@ private void OnStartup() catch { } if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WebPort"))) - Environment.SetEnvironmentVariable("WebPort", "5000"); + Environment.SetEnvironmentVariable("WebPort", ""); if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("localURL"))) Environment.SetEnvironmentVariable("localURL", "http://" + sIP); Console.WriteLine(" "); Console.WriteLine("-------------------------------------------------------------------"); Console.WriteLine("PowerShell Inventory:"); - Console.WriteLine(Environment.ExpandEnvironmentVariables("Invoke-RestMethod -Uri '%localURL%:%WebPort%/getps' | iex")); + if(string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WebPort"))) + Console.WriteLine(Environment.ExpandEnvironmentVariables("Invoke-RestMethod -Uri '%localURL%/getps' | iex")); + else + Console.WriteLine(Environment.ExpandEnvironmentVariables("Invoke-RestMethod -Uri '%localURL%:%WebPort%/getps' | iex")); + Console.WriteLine("-------------------------------------------------------------------"); Console.WriteLine(" "); @@ -250,7 +254,7 @@ private void OnStartup() private Task OnSignIn(BasicSignInContext context) { - if ((context.Password == "password") && (context.UserName =="DEMO")) + if ((context.Password == Environment.GetEnvironmentVariable("ReportPW")) && (context.UserName == Environment.GetEnvironmentVariable("ReportUser"))) { var claims = new[] { new Claim(ClaimsIdentity.DefaultNameClaimType, context.UserName) }; diff --git a/source/jaindb/jaindb.csproj b/source/jaindb/jaindb.csproj index da1ff2b..f8bf9a7 100644 --- a/source/jaindb/jaindb.csproj +++ b/source/jaindb/jaindb.csproj @@ -13,8 +13,8 @@ https://github.com/rzander/jaindb blockchain json 0.9.0 - 0.9.0.36 - 0.9.0.36 + 0.9.0.38 + 0.9.0.38 jaindb.Program fcfd6c0a-e53c-46cb-8a9d-b786c0579861