Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions AuthenticationService/AuthenticationService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,11 @@
</PackageReference>
</ItemGroup>

<ItemGroup>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

перенеси в новый проект AuthenticationWebApi

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если про среды имеешь ввиду, то да, я сделаю для всех проектов

<None Include="appsettings.json" CopyToOutputDirectory="Always" CupyToPublishDirectory="Always" />
<None Include="appsettings.Development.json" CopyToOutputDirectory="Always" CupyToPublishDirectory="Always" />
<None Include="appsettings.Test.json" CopyToOutputDirectory="Always" CupyToPublishDirectory="Always" />
<None Include="appsettings.Production.json" CopyToOutputDirectory="Always" CupyToPublishDirectory="Always" />
</ItemGroup>

</Project>
5 changes: 5 additions & 0 deletions AuthenticationService/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ApplicationDbContext>(options =>
options.UseSqlServer(connectionString));
Expand Down
11 changes: 11 additions & 0 deletions AuthenticationService/appsettings.Production.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"ConnectionStrings": {
"DefaultConnection": ""
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
11 changes: 11 additions & 0 deletions AuthenticationService/appsettings.Test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\MSSQLLocalDB;Database=Authorization;Trusted_Connection=true;"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
2 changes: 1 addition & 1 deletion AuthenticationService/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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" ]
ENTRYPOINT [ "dotnet", "AuthenticationService.dll", "--environment=Test" ]
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,12 @@
<ProjectReference Include="..\Infrastructure.EntityFramework\Infrastructure.EntityFramework.csproj" />
</ItemGroup>

<ItemGroup>
<None Include="appsettings.json" CopyToOutputDirectory="Always" CupyToPublishDirectory="Always" />
<None Include="appsettings.Development.json" CopyToOutputDirectory="Always" CupyToPublishDirectory="Always" />
<None Include="appsettings.Test.json" CopyToOutputDirectory="Always" CupyToPublishDirectory="Always" />
<None Include="appsettings.Production.json" CopyToOutputDirectory="Always" CupyToPublishDirectory="Always" />
</ItemGroup>


</Project>