-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
47a742a
commit ee4d57a
Showing
7 changed files
with
150 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using MassTransit; | ||
using ResQueue; | ||
using ResQueue.Enums; | ||
|
||
var builder = WebApplication.CreateBuilder(args); | ||
|
||
var sqlEngineConfig = builder.Configuration.GetRequiredSection("Resqueue:SqlEngine").Value; | ||
if (string.IsNullOrEmpty(sqlEngineConfig)) | ||
{ | ||
throw new Exception("Missing SqlEngine configuration in Resqueue:SqlEngine."); | ||
} | ||
|
||
var sqlEngine = Enum.Parse<ResQueueSqlEngine>(sqlEngineConfig); | ||
|
||
builder.Services.AddResQueue(opt => opt.SqlEngine = sqlEngine); | ||
|
||
builder.Services.AddOptions<SqlTransportOptions>().Configure(options => | ||
{ | ||
builder.Configuration.Bind("SqlTransport", options); | ||
}); | ||
|
||
if (sqlEngine == ResQueueSqlEngine.Postgres) | ||
{ | ||
builder.Services.AddPostgresMigrationHostedService(); | ||
} | ||
else | ||
{ | ||
builder.Services.AddSqlServerMigrationHostedService(); | ||
} | ||
|
||
builder.Services.AddMassTransit(mt => | ||
{ | ||
if (sqlEngine == ResQueueSqlEngine.Postgres) | ||
{ | ||
mt.UsingPostgres(); | ||
} | ||
else | ||
{ | ||
mt.UsingSqlServer(); | ||
} | ||
}); | ||
|
||
var app = builder.Build(); | ||
|
||
app.UseResQueue(""); | ||
|
||
app.Run(); |
23 changes: 23 additions & 0 deletions
23
backend/ResQueue/ResQueue.Standalone/Properties/launchSettings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/launchsettings.json", | ||
"profiles": { | ||
"http": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": true, | ||
"applicationUrl": "http://localhost:5236", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
}, | ||
"https": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"launchBrowser": true, | ||
"applicationUrl": "https://localhost:7227;http://localhost:5236", | ||
"environmentVariables": { | ||
"ASPNETCORE_ENVIRONMENT": "Development" | ||
} | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
backend/ResQueue/ResQueue.Standalone/ResQueue.Standalone.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net9.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
|
||
<EnableSdkContainerSupport>true</EnableSdkContainerSupport> | ||
<ContainerFamily>alpine</ContainerFamily> | ||
|
||
<ContainerImageTag Condition="'$(PublishToGithubRegistry)' != 'true'">1.0.9</ContainerImageTag> | ||
<Arch Condition="'$(RuntimeIdentifier)' != ''">$(RuntimeIdentifier.Split('-')[1])</Arch> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\ResQueue\ResQueue.csproj"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="MassTransit.SqlTransport.PostgreSQL" Version="8.3.2"/> | ||
<PackageReference Include="MassTransit.SqlTransport.SqlServer" Version="8.3.2"/> | ||
</ItemGroup> | ||
|
||
</Project> |
14 changes: 14 additions & 0 deletions
14
backend/ResQueue/ResQueue.Standalone/appsettings.Development.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
}, | ||
"SqlTransport": { | ||
"ConnectionString": "Host=localhost;Database=sandbox100;Username=postgres;Password=postgres;" | ||
}, | ||
"ResQueue": { | ||
"SqlEngine": "Postgres" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Warning", | ||
"Microsoft.AspNetCore": "Warning" | ||
} | ||
}, | ||
"AllowedHosts": "*" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters