diff --git a/AuthenticationService/AuthenticationService.csproj b/AuthenticationService/AuthenticationService.csproj index 480b683..fb20654 100644 --- a/AuthenticationService/AuthenticationService.csproj +++ b/AuthenticationService/AuthenticationService.csproj @@ -18,4 +18,11 @@ + + + + + + + diff --git a/AuthenticationService/Program.cs b/AuthenticationService/Program.cs index 6db4fc6..dc5cfa5 100644 --- a/AuthenticationService/Program.cs +++ b/AuthenticationService/Program.cs @@ -11,6 +11,11 @@ public static void Main(string[] args) var builder = WebApplication.CreateBuilder(args); // Add services to the container. + builder.Configuration + .AddJsonFile("appsettings.json", false, true) + .AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", false, true) + .AddEnvironmentVariables(); + var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found."); builder.Services.AddDbContext(options => options.UseSqlServer(connectionString)); diff --git a/AuthenticationService/appsettings.Production.json b/AuthenticationService/appsettings.Production.json new file mode 100644 index 0000000..aee69c2 --- /dev/null +++ b/AuthenticationService/appsettings.Production.json @@ -0,0 +1,11 @@ +{ + "ConnectionStrings": { + "DefaultConnection": "" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} \ No newline at end of file diff --git a/AuthenticationService/appsettings.Test.json b/AuthenticationService/appsettings.Test.json new file mode 100644 index 0000000..0bec7df --- /dev/null +++ b/AuthenticationService/appsettings.Test.json @@ -0,0 +1,11 @@ +{ + "ConnectionStrings": { + "DefaultConnection": "Server=(localdb)\\MSSQLLocalDB;Database=Authorization;Trusted_Connection=true;" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} \ No newline at end of file diff --git a/AuthenticationService/dockerfile b/AuthenticationService/dockerfile index 47936ad..14691a5 100644 --- a/AuthenticationService/dockerfile +++ b/AuthenticationService/dockerfile @@ -8,4 +8,4 @@ FROM mcr.microsoft.com/dotnet/aspnet:8.0 WORKDIR /AuthenticationService COPY --from=base /AuthenticationService/out ./ EXPOSE 8080 -ENTRYPOINT [ "dotnet", "AuthenticationService.dll" ] \ No newline at end of file +ENTRYPOINT [ "dotnet", "AuthenticationService.dll", "--environment=Test" ] \ No newline at end of file diff --git a/AuthorizationWebApplication/AuthorizationWebApplication.csproj b/AuthorizationWebApplication/AuthorizationWebApplication.csproj index 2eaabf0..151349c 100644 --- a/AuthorizationWebApplication/AuthorizationWebApplication.csproj +++ b/AuthorizationWebApplication/AuthorizationWebApplication.csproj @@ -21,4 +21,12 @@ + + + + + + + +