diff --git a/.vscode/launch.json b/.vscode/launch.json index 9314b20c..f6e26d70 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -19,7 +19,8 @@ "cwd": "${workspaceFolder}", "stopAtEntry": false, "env": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development", + "ASPNETCORE_URLS": "http://+:8009" } }, { @@ -34,9 +35,9 @@ * - exit * * 2. Configure docker so that port 22 is exposed (e.g. to port 2222), then test the connection: - * - ssh root@ensyno.iwes.fraunhofer.de -p 2222 + * - ssh root@ -p 2222 * - * 3. Replace ensyno.iwes.fraunhofer.de below with the actual host + * 3. Replace below with the actual host */ "name": "Attach to Nexus (Docker)", "type": "coreclr", @@ -46,7 +47,7 @@ "pipeProgram": "ssh", "pipeArgs": [ "-T", - "root@ensyno.iwes.fraunhofer.de", + "root@", "-p", "2222" ], // replace diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 1f242832..b92c9951 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -27,6 +27,7 @@ "--project", "${workspaceFolder}/src/Nexus/Nexus.csproj" ], + "problemMatcher": "$msCompile" }, { diff --git a/CHANGELOG.md b/CHANGELOG.md index dfd5b035..8f04c26e 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## v2.0.0-beta.21 - 2023-09-29 + +### Features: +- Simplify containerization. + ## v2.0.0-beta.20 - 2023-09-29 ### Features: diff --git a/src/Nexus/Utilities/NexusUtilities.cs b/src/Nexus/Utilities/NexusUtilities.cs index 52a71b3b..76cb4e94 100644 --- a/src/Nexus/Utilities/NexusUtilities.cs +++ b/src/Nexus/Utilities/NexusUtilities.cs @@ -2,6 +2,7 @@ using Nexus.DataModel; using System.Runtime.CompilerServices; using System.Runtime.ExceptionServices; +using System.Text.RegularExpressions; namespace Nexus.Utilities { @@ -13,14 +14,21 @@ public static string DefaultBaseUrl { get { - // TODO: make this more dynamic - if (_defaultBaseUrl is null) - _defaultBaseUrl = - Environment.GetEnvironmentVariable("ASPNETCORE_URLS") == "http://+:80" && - Environment.GetEnvironmentVariable("DOTNET_RUNNING_IN_CONTAINER") == "true" - ? "http://localhost:80" - : "http://localhost:5000"; + { + int port = 5000; + var aspnetcoreEnvVar = Environment.GetEnvironmentVariable("ASPNETCORE_URLS"); + + if (aspnetcoreEnvVar is not null) + { + var match = Regex.Match(aspnetcoreEnvVar, ":([0-9]+)"); + + if (match.Success && int.TryParse(match.Groups[1].Value, out var parsedPort)) + port = parsedPort; + } + + _defaultBaseUrl = $"http://localhost:{port}"; + } return _defaultBaseUrl; } diff --git a/version.json b/version.json index 0ad29e73..09cd82e4 100644 --- a/version.json +++ b/version.json @@ -1,4 +1,4 @@ { "version": "2.0.0", - "suffix": "beta.20" + "suffix": "beta.21" } \ No newline at end of file