finally fix environ

This commit is contained in:
Дмитрий Шиманский
2023-12-20 09:39:02 +03:00
parent fa82a26828
commit a1d06708f0
2 changed files with 6 additions and 8 deletions

View File

@@ -21,7 +21,7 @@ ENV PSQL_HOST localhost
ENV PSQL_USER root
ENV PSQL_PASSWORD root
ENV PSQL_DATABASE database
RUN dotnet publish "yaflay.ru.csproj" -c Release -o /app/publish /p:UseAppHost=false;redirectUrl=$CLIENTID;clientId=;clientSecret=$CLIENTSECRET;Host=$PSQL_HOST;Username=$PSQL_USER;Password=$PSQL_PASSWORD;Database=$PSQL_DATABASE
RUN dotnet publish "yaflay.ru.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app

View File

@@ -2,15 +2,13 @@ using Microsoft.AspNetCore.Hosting;
using yaflay.ru;
public class Program
{
public static void Main(string[] args)
public static void Main()
{
Console.WriteLine(args[0]);
var parse = (string name) => Environment.GetEnvironmentVariable(name) ?? null;
Startup.clientId = parse("clientId");
Startup.clientSecret = parse("clientSecret");
Startup.redirectUrl = parse("redirectUrl");
Startup.connectionString = $"Host={parse("Host")};Username={parse("Username")};Password={parse("Password")};Database={parse("Database")}";
Console.WriteLine(parse("CLIENTID"));
Startup.clientId = parse("CLIENTID");
Startup.clientSecret = parse("CLIENTSECRET");
Startup.redirectUrl = parse("REDIRECTURL");
Startup.connectionString = $"Host={parse("PSQL_HOST")};Username={parse("PSQL_USER")};Password={parse("PSQL_PASSWORD")};Database={parse("PSQL_DATABASE")}";
CreateHostBuilder()
.Build()
.Run();