2024-05-27 15:53:54 +02:00
|
|
|
using Serilog.Events;
|
|
|
|
|
|
|
|
namespace Foxnouns.Backend;
|
|
|
|
|
|
|
|
public class Config
|
|
|
|
{
|
2024-06-12 03:47:20 +02:00
|
|
|
public string Host { get; init; } = "localhost";
|
|
|
|
public int Port { get; init; } = 3000;
|
2024-07-12 17:12:24 +02:00
|
|
|
public string BaseUrl { get; set; } = null!;
|
|
|
|
public string MediaBaseUrl { get; set; } = null!;
|
2024-05-27 15:53:54 +02:00
|
|
|
|
|
|
|
public string Address => $"http://{Host}:{Port}";
|
2024-09-03 17:00:14 +02:00
|
|
|
public string MetricsAddress => $"http://{Host}:{Logging.MetricsPort}";
|
2024-05-27 15:53:54 +02:00
|
|
|
|
2024-07-08 19:03:04 +02:00
|
|
|
public LoggingConfig Logging { get; init; } = new();
|
2024-06-12 03:47:20 +02:00
|
|
|
public DatabaseConfig Database { get; init; } = new();
|
2024-07-08 19:03:04 +02:00
|
|
|
public StorageConfig Storage { get; init; } = new();
|
2024-06-12 03:47:20 +02:00
|
|
|
public DiscordAuthConfig DiscordAuth { get; init; } = new();
|
2024-06-12 16:19:49 +02:00
|
|
|
public GoogleAuthConfig GoogleAuth { get; init; } = new();
|
|
|
|
public TumblrAuthConfig TumblrAuth { get; init; } = new();
|
2024-05-27 15:53:54 +02:00
|
|
|
|
2024-07-08 19:03:04 +02:00
|
|
|
public class LoggingConfig
|
|
|
|
{
|
|
|
|
public LogEventLevel LogEventLevel { get; init; } = LogEventLevel.Debug;
|
|
|
|
public string? SeqLogUrl { get; init; }
|
|
|
|
public string? SentryUrl { get; init; }
|
|
|
|
public bool SentryTracing { get; init; } = false;
|
|
|
|
public double SentryTracesSampleRate { get; init; } = 0.0;
|
2024-07-13 03:09:00 +02:00
|
|
|
public bool LogQueries { get; init; } = false;
|
2024-09-03 17:00:14 +02:00
|
|
|
public bool EnableMetrics { get; init; } = false;
|
|
|
|
public ushort MetricsPort { get; init; } = 5001;
|
2024-07-08 19:03:04 +02:00
|
|
|
}
|
|
|
|
|
2024-05-27 15:53:54 +02:00
|
|
|
public class DatabaseConfig
|
|
|
|
{
|
2024-06-12 03:47:20 +02:00
|
|
|
public string Url { get; init; } = string.Empty;
|
|
|
|
public int? Timeout { get; init; }
|
|
|
|
public int? MaxPoolSize { get; init; }
|
|
|
|
}
|
|
|
|
|
2024-07-08 19:03:04 +02:00
|
|
|
public class StorageConfig
|
|
|
|
{
|
|
|
|
public string Endpoint { get; init; } = string.Empty;
|
|
|
|
public string AccessKey { get; init; } = string.Empty;
|
|
|
|
public string SecretKey { get; init; } = string.Empty;
|
|
|
|
public string Bucket { get; init; } = string.Empty;
|
|
|
|
}
|
|
|
|
|
2024-06-12 03:47:20 +02:00
|
|
|
public class DiscordAuthConfig
|
|
|
|
{
|
2024-06-12 16:19:49 +02:00
|
|
|
public bool Enabled => ClientId != null && ClientSecret != null;
|
|
|
|
|
|
|
|
public string? ClientId { get; init; }
|
|
|
|
public string? ClientSecret { get; init; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public class GoogleAuthConfig
|
|
|
|
{
|
|
|
|
public bool Enabled => ClientId != null && ClientSecret != null;
|
|
|
|
|
|
|
|
public string? ClientId { get; init; }
|
|
|
|
public string? ClientSecret { get; init; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public class TumblrAuthConfig
|
|
|
|
{
|
|
|
|
public bool Enabled => ClientId != null && ClientSecret != null;
|
|
|
|
|
2024-06-12 03:47:20 +02:00
|
|
|
public string? ClientId { get; init; }
|
|
|
|
public string? ClientSecret { get; init; }
|
2024-05-27 15:53:54 +02:00
|
|
|
}
|
|
|
|
}
|