Radarr/src/Radarr.Api.V3/Config/HostConfigResource.cs

92 lines
4.0 KiB
C#
Raw Normal View History

2019-12-22 22:08:53 +00:00
using NzbDrone.Common.Http.Proxy;
2018-11-23 07:03:32 +00:00
using NzbDrone.Core.Authentication;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Security;
2018-11-23 07:03:32 +00:00
using NzbDrone.Core.Update;
2019-12-22 22:08:53 +00:00
using Radarr.Http.REST;
2018-11-23 07:03:32 +00:00
namespace Radarr.Api.V3.Config
2018-11-23 07:03:32 +00:00
{
public class HostConfigResource : RestResource
{
public string BindAddress { get; set; }
public int Port { get; set; }
public int SslPort { get; set; }
public bool EnableSsl { get; set; }
public bool LaunchBrowser { get; set; }
public AuthenticationType AuthenticationMethod { get; set; }
public bool AnalyticsEnabled { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public string LogLevel { get; set; }
2019-07-15 01:18:03 +00:00
public string ConsoleLogLevel { get; set; }
2018-11-23 07:03:32 +00:00
public string Branch { get; set; }
public string ApiKey { get; set; }
public string SslCertPath { get; set; }
public string SslCertPassword { get; set; }
2018-11-23 07:03:32 +00:00
public string UrlBase { get; set; }
2022-05-12 16:10:10 +00:00
public string InstanceName { get; set; }
public string ApplicationUrl { get; set; }
2018-11-23 07:03:32 +00:00
public bool UpdateAutomatically { get; set; }
public UpdateMechanism UpdateMechanism { get; set; }
public string UpdateScriptPath { get; set; }
public bool ProxyEnabled { get; set; }
public ProxyType ProxyType { get; set; }
public string ProxyHostname { get; set; }
public int ProxyPort { get; set; }
public string ProxyUsername { get; set; }
public string ProxyPassword { get; set; }
public string ProxyBypassFilter { get; set; }
public bool ProxyBypassLocalAddresses { get; set; }
public CertificateValidationType CertificateValidation { get; set; }
2018-11-23 07:03:32 +00:00
public string BackupFolder { get; set; }
public int BackupInterval { get; set; }
public int BackupRetention { get; set; }
}
public static class HostConfigResourceMapper
{
public static HostConfigResource ToResource(this IConfigFileProvider model, IConfigService configService)
{
// TODO: Clean this mess up. don't mix data from multiple classes, use sub-resources instead?
return new HostConfigResource
{
BindAddress = model.BindAddress,
Port = model.Port,
SslPort = model.SslPort,
EnableSsl = model.EnableSsl,
LaunchBrowser = model.LaunchBrowser,
AuthenticationMethod = model.AuthenticationMethod,
AnalyticsEnabled = model.AnalyticsEnabled,
2019-12-22 22:08:53 +00:00
2022-11-20 18:27:45 +00:00
// Username
// Password
2018-11-23 07:03:32 +00:00
LogLevel = model.LogLevel,
2019-07-15 01:18:03 +00:00
ConsoleLogLevel = model.ConsoleLogLevel,
2018-11-23 07:03:32 +00:00
Branch = model.Branch,
ApiKey = model.ApiKey,
SslCertPath = model.SslCertPath,
SslCertPassword = model.SslCertPassword,
2018-11-23 07:03:32 +00:00
UrlBase = model.UrlBase,
2022-05-12 16:10:10 +00:00
InstanceName = model.InstanceName,
2018-11-23 07:03:32 +00:00
UpdateAutomatically = model.UpdateAutomatically,
UpdateMechanism = model.UpdateMechanism,
UpdateScriptPath = model.UpdateScriptPath,
ProxyEnabled = configService.ProxyEnabled,
ProxyType = configService.ProxyType,
ProxyHostname = configService.ProxyHostname,
ProxyPort = configService.ProxyPort,
ProxyUsername = configService.ProxyUsername,
ProxyPassword = configService.ProxyPassword,
ProxyBypassFilter = configService.ProxyBypassFilter,
ProxyBypassLocalAddresses = configService.ProxyBypassLocalAddresses,
CertificateValidation = configService.CertificateValidation,
2018-11-23 07:03:32 +00:00
BackupFolder = configService.BackupFolder,
BackupInterval = configService.BackupInterval,
BackupRetention = configService.BackupRetention,
ApplicationUrl = configService.ApplicationUrl
2018-11-23 07:03:32 +00:00
};
}
}
}