Skip to content

Commit

Permalink
Simplify containerization
Browse files Browse the repository at this point in the history
  • Loading branch information
Apollo3zehn committed Sep 29, 2023
1 parent 2906996 commit a2ed84d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 12 deletions.
9 changes: 5 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_URLS": "http://+:8009"
}
},
{
Expand All @@ -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@<docker-host> -p 2222
*
* 3. Replace ensyno.iwes.fraunhofer.de below with the actual host
* 3. Replace <docker-host> below with the actual host
*/
"name": "Attach to Nexus (Docker)",
"type": "coreclr",
Expand All @@ -46,7 +47,7 @@
"pipeProgram": "ssh",
"pipeArgs": [
"-T",
"root@ensyno.iwes.fraunhofer.de",
"root@<docker-host>",
"-p",
"2222"
], // replace <docker host>
Expand Down
1 change: 1 addition & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"--project",
"${workspaceFolder}/src/Nexus/Nexus.csproj"
],

"problemMatcher": "$msCompile"
},
{
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v2.0.0-beta.21 - 2023-09-29

### Features:
- Simplify containerization.

## v2.0.0-beta.20 - 2023-09-29

### Features:
Expand Down
22 changes: 15 additions & 7 deletions src/Nexus/Utilities/NexusUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Nexus.DataModel;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Text.RegularExpressions;

namespace Nexus.Utilities
{
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "2.0.0",
"suffix": "beta.20"
"suffix": "beta.21"
}

0 comments on commit a2ed84d

Please sign in to comment.