fix: database upgrade and added basic timer

This commit is contained in:
Michael Green
2023-03-11 01:04:03 +11:00
parent d484ee32cb
commit 13dc90883d
11 changed files with 157 additions and 25 deletions

View File

@@ -1,6 +1,12 @@
using System.Text.Json.Serialization;
using gaseous_server;
using gaseous_tools;
// set up db
Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString);
db.InitDB();
// set up server
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
@@ -13,6 +19,7 @@ builder.Services.AddControllers().AddJsonOptions(x =>
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddHostedService<TimedHostedService>();
var app = builder.Build();
@@ -29,10 +36,6 @@ app.UseAuthorization();
app.MapControllers();
// set up db
Database db = new gaseous_tools.Database(Database.databaseType.MySql, Config.DatabaseConfiguration.ConnectionString);
db.InitDB();
// start the app
app.Run();