void.cat/VoidCat/Model/VoidSettings.cs

234 lines
6.6 KiB
C#
Raw Permalink Normal View History

2022-02-22 14:20:31 +00:00
using VoidCat.Services.Strike;
2022-02-21 09:39:59 +00:00
namespace VoidCat.Model
2022-01-25 16:17:48 +00:00
{
2022-06-14 10:46:31 +00:00
/// <summary>
/// System settings
/// </summary>
2022-01-25 16:17:48 +00:00
public class VoidSettings
{
2023-04-27 08:51:11 +00:00
/// <summary>
/// Maintenance flag
/// </summary>
public bool MaintenanceMode { get; init; } = false;
2023-11-02 16:13:08 +00:00
2022-09-08 09:41:31 +00:00
/// <summary>
/// Base site url, used for redirect urls
/// </summary>
public Uri SiteUrl { get; init; }
2022-06-14 10:46:31 +00:00
/// <summary>
/// Data directory to store files in
/// </summary>
2022-01-25 23:39:51 +00:00
public string DataDirectory { get; init; } = "./data";
2022-08-28 20:28:51 +00:00
2022-08-28 12:15:50 +00:00
/// <summary>
/// Size in bytes to split uploads into chunks
/// </summary>
2022-09-08 09:41:31 +00:00
public ulong? UploadSegmentSize { get; init; }
2023-12-25 18:50:32 +00:00
/// <summary>
/// Max file size for upload
/// </summary>
public ulong? MaxFileSize { get; init; }
2022-08-28 20:28:51 +00:00
2022-06-14 10:46:31 +00:00
/// <summary>
/// Tor configuration
/// </summary>
2022-02-13 15:44:17 +00:00
public TorSettings? TorSettings { get; init; }
2022-06-14 10:46:31 +00:00
/// <summary>
/// JWT settings for login token signing
/// </summary>
2022-03-07 16:29:52 +00:00
public JwtSettings JwtSettings { get; init; } = new()
{
Issuer = "void_cat_internal",
Key = "default_key_void_cat_host"
};
2022-06-14 10:46:31 +00:00
/// <summary>
/// Redis database connection string
/// </summary>
2022-02-16 23:19:31 +00:00
public string? Redis { get; init; }
2022-03-07 16:29:52 +00:00
2022-06-14 10:46:31 +00:00
/// <summary>
/// Strike payment service api settings
/// </summary>
2022-02-21 09:39:59 +00:00
public StrikeApiSettings? Strike { get; init; }
2022-03-07 16:29:52 +00:00
2022-06-14 10:46:31 +00:00
/// <summary>
/// Email server settings
/// </summary>
2022-02-22 14:20:31 +00:00
public SmtpSettings? Smtp { get; init; }
2022-02-26 14:22:22 +00:00
2022-06-14 10:46:31 +00:00
/// <summary>
/// CORS origins
/// </summary>
2023-12-06 12:10:27 +00:00
public List<string> CorsOrigins { get; init; } = new();
2022-03-07 16:29:52 +00:00
2022-06-14 10:46:31 +00:00
/// <summary>
/// Cloud file storage settings
/// </summary>
2022-03-01 16:48:42 +00:00
public CloudStorageSettings? CloudStorage { get; init; }
2022-03-07 16:29:52 +00:00
2022-06-14 10:46:31 +00:00
/// <summary>
/// Virus scanner settings
/// </summary>
2022-03-07 13:38:28 +00:00
public VirusScannerSettings? VirusScanner { get; init; }
2022-08-28 20:28:51 +00:00
2022-06-14 10:46:31 +00:00
/// <summary>
/// Request header to unmask in the logs, otherwise all are masked
/// </summary>
2022-03-11 15:59:08 +00:00
public IEnumerable<string>? RequestHeadersLog { get; init; }
2022-08-28 20:28:51 +00:00
2022-06-14 10:46:31 +00:00
/// <summary>
/// hCaptcha settings
/// </summary>
2022-03-11 15:59:08 +00:00
public CaptchaSettings? CaptchaSettings { get; init; }
2022-08-28 20:28:51 +00:00
2022-06-14 10:46:31 +00:00
/// <summary>
/// Postgres database connection string
/// </summary>
2022-06-06 21:51:25 +00:00
public string? Postgres { get; init; }
2022-08-28 20:28:51 +00:00
2022-06-14 10:46:31 +00:00
/// <summary>
/// Prometheus server for querying metrics
/// </summary>
2022-08-28 20:28:51 +00:00
public PrometheusSettings? Prometheus { get; init; }
/// <summary>
/// Select where to store metadata, if not set "local-disk" will be used
/// </summary>
public string MetadataStore { get; init; } = "local-disk";
/// <summary>
/// Select which store to use for files storage, if not set "local-disk" will be used
/// </summary>
public string DefaultFileStore { get; init; } = "local-disk";
2022-09-08 09:41:31 +00:00
2022-09-07 11:40:52 +00:00
/// <summary>
/// Plausible Analytics endpoint url
/// </summary>
public PlausibleSettings? PlausibleAnalytics { get; init; }
2022-09-08 09:41:31 +00:00
/// <summary>
/// Discord application settings
/// </summary>
2022-09-08 12:38:32 +00:00
public OAuthDetails? Discord { get; init; }
2023-03-04 20:31:53 +00:00
2022-09-08 12:38:32 +00:00
/// <summary>
/// Google application settings
/// </summary>
public OAuthDetails? Google { get; init; }
2023-03-04 20:31:53 +00:00
/// <summary>
/// A list of trackers to attach to torrent files
/// </summary>
public List<string> TorrentTrackers { get; init; } = new()
{
"wss://tracker.btorrent.xyz",
"wss://tracker.openwebtorrent.com",
"udp://tracker.opentrackr.org:1337/announce",
"udp://tracker.openbittorrent.com:6969/announce",
"http://tracker.openbittorrent.com:80/announce"
};
2023-11-02 16:13:08 +00:00
/// <summary>
/// Lightning node configuration for LNProxy services
/// </summary>
public LndConfig? LndConfig { get; init; }
2023-11-02 16:13:08 +00:00
/// <summary>
/// Blocked origin hostnames
/// </summary>
public List<string> BlockedOrigins { get; init; } = new();
2022-01-25 16:17:48 +00:00
}
2022-02-16 16:33:00 +00:00
2022-03-07 16:29:52 +00:00
public sealed class TorSettings
{
public Uri TorControl { get; init; }
public string PrivateKey { get; init; }
public string ControlPassword { get; init; }
}
2022-02-16 16:33:00 +00:00
2022-03-07 16:29:52 +00:00
public sealed class JwtSettings
{
public string Issuer { get; init; }
public string Key { get; init; }
}
2022-02-22 14:20:31 +00:00
2022-03-07 16:29:52 +00:00
public sealed class SmtpSettings
2022-03-01 16:48:42 +00:00
{
public Uri? Server { get; init; }
public string? Username { get; init; }
public string? Password { get; init; }
}
2022-03-07 16:29:52 +00:00
public sealed class CloudStorageSettings
2022-03-01 16:48:42 +00:00
{
public S3BlobConfig[]? S3 { get; init; }
2022-03-01 16:48:42 +00:00
}
2022-03-07 16:29:52 +00:00
public sealed class S3BlobConfig
2022-03-01 16:48:42 +00:00
{
public string Name { get; init; } = null!;
2022-03-01 16:48:42 +00:00
public string? AccessKey { get; init; }
public string? SecretKey { get; init; }
public Uri? ServiceUrl { get; init; }
public string? Region { get; init; }
public string? BucketName { get; init; } = "void-cat";
public bool Direct { get; init; }
2022-07-26 13:01:14 +00:00
public bool SendChecksum { get; init; } = true;
2022-07-26 13:15:15 +00:00
public bool DisablePayloadSigning { get; init; }
2022-03-01 16:48:42 +00:00
}
2022-03-07 13:38:28 +00:00
2022-03-07 16:29:52 +00:00
public sealed class VirusScannerSettings
2022-03-07 13:38:28 +00:00
{
2022-03-07 16:29:52 +00:00
public ClamAVSettings? ClamAV { get; init; }
public VirusTotalConfig? VirusTotal { get; init; }
2022-03-07 13:38:28 +00:00
}
2022-03-07 14:43:19 +00:00
2022-03-07 16:29:52 +00:00
public sealed class ClamAVSettings
2022-03-07 14:49:23 +00:00
{
public Uri? Endpoint { get; init; }
public long? MaxStreamSize { get; init; }
}
2022-03-07 16:29:52 +00:00
public sealed class VirusTotalConfig
{
public string? ApiKey { get; init; }
}
2022-03-11 15:59:08 +00:00
public sealed class CaptchaSettings
{
public string? SiteKey { get; init; }
public string? Secret { get; init; }
}
2022-08-28 20:28:51 +00:00
public sealed class PrometheusSettings
{
public Uri? Url { get; init; }
public string? EgressQuery { get; init; }
}
2022-09-07 11:40:52 +00:00
public sealed class PlausibleSettings
{
public Uri? Endpoint { get; init; }
public string? Domain { get; init; }
}
2022-09-08 09:41:31 +00:00
2022-09-08 12:38:32 +00:00
public sealed class OAuthDetails
2022-09-08 09:41:31 +00:00
{
public string? ClientId { get; init; }
public string? ClientSecret { get; init; }
}
public sealed class LndConfig
{
public string Network { get; init; } = "regtest";
public Uri Endpoint { get; init; }
public string CertPath { get; init; } = null!;
public string MacaroonPath { get; init; } = null!;
}
2023-03-04 20:31:53 +00:00
}