commit d50ec46b0818fdbf41963eb8dc156ed6d96b48ae Author: hzhang Date: Sat May 3 20:06:51 2025 +0100 init diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..cd967fc --- /dev/null +++ b/.dockerignore @@ -0,0 +1,25 @@ +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/.idea +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..add57be --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +bin/ +obj/ +/packages/ +riderModule.iml +/_ReSharper.Caches/ \ No newline at end of file diff --git a/Alchegos.N8N.Variable.csproj b/Alchegos.N8N.Variable.csproj new file mode 100644 index 0000000..835ec5f --- /dev/null +++ b/Alchegos.N8N.Variable.csproj @@ -0,0 +1,14 @@ + + + + net9.0 + enable + enable + Linux + + + + + + + diff --git a/Alchegos.N8N.Variable.http b/Alchegos.N8N.Variable.http new file mode 100644 index 0000000..8664a26 --- /dev/null +++ b/Alchegos.N8N.Variable.http @@ -0,0 +1,6 @@ +@Alchegos.N8N.Variable_HostAddress = http://localhost:5038 + +GET {{Alchegos.N8N.Variable_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/Alchegos.N8N.Variable.sln b/Alchegos.N8N.Variable.sln new file mode 100644 index 0000000..727b9d6 --- /dev/null +++ b/Alchegos.N8N.Variable.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Alchegos.N8N.Variable", "Alchegos.N8N.Variable.csproj", "{DCE55DAE-F82D-4759-B4A2-00AE1C67F4FA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DCE55DAE-F82D-4759-B4A2-00AE1C67F4FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DCE55DAE-F82D-4759-B4A2-00AE1C67F4FA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DCE55DAE-F82D-4759-B4A2-00AE1C67F4FA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DCE55DAE-F82D-4759-B4A2-00AE1C67F4FA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..19393db --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base +USER $APP_UID +WORKDIR /app +EXPOSE 8080 +EXPOSE 8081 + +FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["Alchegos.N8N.Variable.csproj", "./"] +RUN dotnet restore "Alchegos.N8N.Variable.csproj" +COPY . . +WORKDIR "/src/" +RUN dotnet build "./Alchegos.N8N.Variable.csproj" -c $BUILD_CONFIGURATION -o /app/build + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./Alchegos.N8N.Variable.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "Alchegos.N8N.Variable.dll"] diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..d5e0ef3 --- /dev/null +++ b/Program.cs @@ -0,0 +1,41 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. +// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi +builder.Services.AddOpenApi(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.MapOpenApi(); +} + +app.UseHttpsRedirection(); + +var summaries = new[] +{ + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" +}; + +app.MapGet("/weatherforecast", () => + { + var forecast = Enumerable.Range(1, 5).Select(index => + new WeatherForecast + ( + DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + Random.Shared.Next(-20, 55), + summaries[Random.Shared.Next(summaries.Length)] + )) + .ToArray(); + return forecast; + }) + .WithName("GetWeatherForecast"); + +app.Run(); + +record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary) +{ + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); +} \ No newline at end of file diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json new file mode 100644 index 0000000..9a6c4fd --- /dev/null +++ b/Properties/launchSettings.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "http://localhost:5038", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7246;http://localhost:5038", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/appsettings.Development.json b/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/appsettings.json b/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +}