Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
Atralupus committed Feb 21, 2024
1 parent 7678ec3 commit f073a11
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>dotnet-NineChroniclesUtilBackend.Store-bccda56f-4d38-484b-ab03-ebb26065c837</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Lib9c" Version="1.8.0-dev.4e2f5d9bfed5366a94e67b88c4b0e7171c0cd0d6" />
<PackageReference Include="Libplanet" Version="4.1.0-dev.20242745721" />
</ItemGroup>
</Project>
7 changes: 7 additions & 0 deletions NineChroniclesUtilBackend.Store/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using NineChroniclesUtilBackend.Store;

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

var host = builder.Build();
host.Run();
12 changes: 12 additions & 0 deletions NineChroniclesUtilBackend.Store/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"NineChroniclesUtilBackend.Store": {
"commandName": "Project",
"dotnetRunMessages": true,
"environmentVariables": {
"DOTNET_ENVIRONMENT": "Development"
}
}
}
}
23 changes: 23 additions & 0 deletions NineChroniclesUtilBackend.Store/Worker.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace NineChroniclesUtilBackend.Store;

public class Worker : BackgroundService
{
private readonly ILogger<Worker> _logger;

public Worker(ILogger<Worker> logger)
{
_logger = logger;
}

protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
while (!stoppingToken.IsCancellationRequested)
{
if (_logger.IsEnabled(LogLevel.Information))
{
_logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
}
await Task.Delay(1000, stoppingToken);
}
}
}
8 changes: 8 additions & 0 deletions NineChroniclesUtilBackend.Store/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
8 changes: 8 additions & 0 deletions NineChroniclesUtilBackend.Store/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}
8 changes: 7 additions & 1 deletion NineChroniclesUtilBackend.sln
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NineChroniclesUtilBackend", "NineChroniclesUtilBackend\NineChroniclesUtilBackend.csproj", "{1909E492-D010-4FB5-BC4B-DEF73025C41E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NineChroniclesUtilBackend.Store", "NineChroniclesUtilBackend.Store\NineChroniclesUtilBackend.Store.csproj", "{462CDFD3-650B-46A7-A937-8E3BCE7E527C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -18,5 +20,9 @@ Global
{1909E492-D010-4FB5-BC4B-DEF73025C41E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1909E492-D010-4FB5-BC4B-DEF73025C41E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1909E492-D010-4FB5-BC4B-DEF73025C41E}.Release|Any CPU.Build.0 = Release|Any CPU
{462CDFD3-650B-46A7-A937-8E3BCE7E527C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{462CDFD3-650B-46A7-A937-8E3BCE7E527C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{462CDFD3-650B-46A7-A937-8E3BCE7E527C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{462CDFD3-650B-46A7-A937-8E3BCE7E527C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

0 comments on commit f073a11

Please sign in to comment.