Skip to content

Commit

Permalink
🐔 app: switch to generic host
Browse files Browse the repository at this point in the history
  • Loading branch information
database64128 committed May 16, 2024
1 parent 23c31a8 commit 5b765fc
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 54 deletions.
15 changes: 10 additions & 5 deletions CubicBot.Telegram.App/CubicBot.Telegram.App.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<ItemGroup>
<ProjectReference Include="..\CubicBot.Telegram\CubicBot.Telegram.csproj" />
</ItemGroup>
<Project Sdk="Microsoft.NET.Sdk.Worker">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>dotnet-CubicBot.Telegram.App-6b3818c3-5fb6-4bba-91c1-f56f55ecc380</UserSecretsId>
<ServerGarbageCollection>true</ServerGarbageCollection>
<AssemblyName>cubic-bot-telegram-app</AssemblyName>
<Version>1.2.0</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\CubicBot.Telegram\CubicBot.Telegram.csproj" />
</ItemGroup>
</Project>
8 changes: 3 additions & 5 deletions CubicBot.Telegram.App/Program.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using CubicBot.Telegram;

var builder = WebApplication.CreateBuilder(args);

var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddHostedService<BotService>();

var app = builder.Build();

await app.RunAsync();
var host = builder.Build();
host.Run();
30 changes: 2 additions & 28 deletions CubicBot.Telegram.App/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,11 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:11932",
"sslPort": 44318
}
},
"profiles": {
"http": {
"CubicBot.Telegram.App": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5178",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7041;http://localhost:5178",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
"DOTNET_ENVIRONMENT": "Development"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion CubicBot.Telegram.App/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
5 changes: 2 additions & 3 deletions CubicBot.Telegram.App/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}
}
23 changes: 11 additions & 12 deletions CubicBot.Telegram.App/appsettings.systemd.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"Console": {
"FormatterName": "systemd"
},
"AllowedHosts": "*"
}
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"Console": {
"FormatterName": "systemd"
}
}

0 comments on commit 5b765fc

Please sign in to comment.