diff --git a/frontend/src/Settings/General/GeneralSettings.js b/frontend/src/Settings/General/GeneralSettings.js
index 1fd14b924..25cef72a6 100644
--- a/frontend/src/Settings/General/GeneralSettings.js
+++ b/frontend/src/Settings/General/GeneralSettings.js
@@ -20,6 +20,7 @@ const requiresRestartKeys = [
'bindAddress',
'port',
'urlBase',
+ 'instanceName',
'enableSsl',
'sslPort',
'sslCertHash',
diff --git a/frontend/src/Settings/General/HostSettings.js b/frontend/src/Settings/General/HostSettings.js
index 73ca53520..7133d926e 100644
--- a/frontend/src/Settings/General/HostSettings.js
+++ b/frontend/src/Settings/General/HostSettings.js
@@ -19,6 +19,7 @@ function HostSettings(props) {
bindAddress,
port,
urlBase,
+ instanceName,
enableSsl,
sslPort,
sslCertHash,
@@ -71,6 +72,22 @@ function HostSettings(props) {
/>
+
+ Instance Name
+
+
+
+
GetValue("UiFolder", "UI", false);GetValue("UiFolder", "UI", false);
public string UiFolder => "UI";
+ public string InstanceName
+ {
+ get
+ {
+ var instanceName = GetValue("InstanceName", BuildInfo.AppName);
+
+ if (instanceName.StartsWith(BuildInfo.AppName) || instanceName.EndsWith(BuildInfo.AppName) )
+ {
+ return instanceName;
+ }
+ return BuildInfo.AppName;
+ }
+ }
public bool UpdateAutomatically => GetValueBoolean("UpdateAutomatically", false, false);
@@ -218,7 +232,6 @@ namespace NzbDrone.Core.Configuration
public string SyslogLevel => GetValue("SyslogLevel", LogLevel, persist: false).ToLowerInvariant();
-
public int GetValueInt(string key, int defaultValue, bool persist = true)
{
return Convert.ToInt32(GetValue(key, defaultValue));
diff --git a/src/NzbDrone.Core/Validation/RuleBuilderExtensions.cs b/src/NzbDrone.Core/Validation/RuleBuilderExtensions.cs
index df9043fd0..8699d156c 100644
--- a/src/NzbDrone.Core/Validation/RuleBuilderExtensions.cs
+++ b/src/NzbDrone.Core/Validation/RuleBuilderExtensions.cs
@@ -62,5 +62,11 @@ namespace NzbDrone.Core.Validation
{
return ruleBuilder.WithState(v => NzbDroneValidationState.Warning);
}
+
+ public static IRuleBuilderOptions StartsOrEndsWithSonarr(this IRuleBuilder ruleBuilder)
+ {
+ ruleBuilder.SetValidator(new NotEmptyValidator(null));
+ return ruleBuilder.SetValidator(new RegularExpressionValidator("^Sonarr|Sonarr$")).WithMessage("Must start or end with Sonarr");
+ }
}
}
diff --git a/src/Sonarr.Api.V3/Config/HostConfigModule.cs b/src/Sonarr.Api.V3/Config/HostConfigModule.cs
index eb9021929..10d74562c 100644
--- a/src/Sonarr.Api.V3/Config/HostConfigModule.cs
+++ b/src/Sonarr.Api.V3/Config/HostConfigModule.cs
@@ -38,6 +38,7 @@ namespace Sonarr.Api.V3.Config
SharedValidator.RuleFor(c => c.Port).ValidPort();
SharedValidator.RuleFor(c => c.UrlBase).ValidUrlBase();
+ SharedValidator.RuleFor(c => c.InstanceName).StartsOrEndsWithSonarr();
SharedValidator.RuleFor(c => c.Username).NotEmpty().When(c => c.AuthenticationMethod != AuthenticationType.None);
SharedValidator.RuleFor(c => c.Password).NotEmpty().When(c => c.AuthenticationMethod != AuthenticationType.None);
diff --git a/src/Sonarr.Api.V3/Config/HostConfigResource.cs b/src/Sonarr.Api.V3/Config/HostConfigResource.cs
index 8fd147dac..ff3bc777f 100644
--- a/src/Sonarr.Api.V3/Config/HostConfigResource.cs
+++ b/src/Sonarr.Api.V3/Config/HostConfigResource.cs
@@ -24,6 +24,7 @@ namespace Sonarr.Api.V3.Config
public string ApiKey { get; set; }
public string SslCertHash { get; set; }
public string UrlBase { get; set; }
+ public string InstanceName { get; set; }
public bool UpdateAutomatically { get; set; }
public UpdateMechanism UpdateMechanism { get; set; }
public string UpdateScriptPath { get; set; }
@@ -63,6 +64,7 @@ namespace Sonarr.Api.V3.Config
ApiKey = model.ApiKey,
SslCertHash = model.SslCertHash,
UrlBase = model.UrlBase,
+ InstanceName = model.InstanceName,
UpdateAutomatically = model.UpdateAutomatically,
UpdateMechanism = model.UpdateMechanism,
UpdateScriptPath = model.UpdateScriptPath,