feat: start dashboard
This commit is contained in:
parent
bacbc6db0e
commit
ec7aa9faba
50 changed files with 3624 additions and 18 deletions
|
|
@ -13,11 +13,13 @@
|
|||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Catalogger.Backend.Api.Middleware;
|
||||
using Catalogger.Backend.Bot.Commands;
|
||||
using Catalogger.Backend.Database;
|
||||
using Catalogger.Backend.Extensions;
|
||||
using Catalogger.Backend.Services;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Prometheus;
|
||||
using Remora.Commands.Extensions;
|
||||
using Remora.Discord.API.Abstractions.Gateway.Commands;
|
||||
|
|
@ -39,12 +41,14 @@ builder.AddSerilog(config);
|
|||
|
||||
builder
|
||||
.Services.AddControllers()
|
||||
.AddNewtonsoftJson(o =>
|
||||
o.SerializerSettings.ContractResolver = new DefaultContractResolver
|
||||
{
|
||||
NamingStrategy = new SnakeCaseNamingStrategy(),
|
||||
}
|
||||
);
|
||||
.AddJsonOptions(options =>
|
||||
{
|
||||
options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.SnakeCaseLower;
|
||||
options.JsonSerializerOptions.PropertyNameCaseInsensitive = true;
|
||||
options.JsonSerializerOptions.IncludeFields = true;
|
||||
options.JsonSerializerOptions.NumberHandling =
|
||||
JsonNumberHandling.WriteAsString | JsonNumberHandling.AllowReadingFromString;
|
||||
});
|
||||
|
||||
builder
|
||||
.Host.AddShardedDiscordService(_ => config.Discord.Token)
|
||||
|
|
@ -106,6 +110,7 @@ if (!config.Logging.EnableMetrics)
|
|||
|
||||
builder
|
||||
.Services.AddDbContext<DatabaseContext>()
|
||||
.MaybeAddDashboardServices(config)
|
||||
.MaybeAddRedisCaches(config)
|
||||
.AddCustomServices()
|
||||
.AddEndpointsApiExplorer()
|
||||
|
|
@ -114,14 +119,7 @@ builder
|
|||
var app = builder.Build();
|
||||
|
||||
await app.Initialize();
|
||||
|
||||
app.UseSerilogRequestLogging();
|
||||
app.UseRouting();
|
||||
app.UseHttpMetrics();
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
app.UseCors();
|
||||
app.MapControllers();
|
||||
app.MaybeAddDashboard();
|
||||
|
||||
app.Urls.Clear();
|
||||
app.Urls.Add(config.Web.Address);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue