aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-02-14 16:35:09 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-02-14 16:35:09 -0500
commitdaa0b6cd0ecefd60611752802d062c15e6da85de (patch)
treef58a16e47afed9b61471e3871280faa9fc8bd951 /MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs
parent7d26b8995f313917829573a7cd96c37decc9158a (diff)
parentfd5f12e76227d96c52cdc31b67ef9543b485169b (diff)
Merge branch 'beta'
Diffstat (limited to 'MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs39
1 files changed, 24 insertions, 15 deletions
diff --git a/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs b/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs
index d7df37332..1a5c35df8 100644
--- a/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs
+++ b/MediaBrowser.Server.Implementations/Configuration/ServerConfigurationManager.cs
@@ -35,7 +35,6 @@ namespace MediaBrowser.Server.Implementations.Configuration
public ServerConfigurationManager(IApplicationPaths applicationPaths, ILogManager logManager, IXmlSerializer xmlSerializer, IFileSystem fileSystem)
: base(applicationPaths, logManager, xmlSerializer, fileSystem)
{
- UpdateItemsByNamePath();
UpdateMetadataPath();
}
@@ -73,7 +72,6 @@ namespace MediaBrowser.Server.Implementations.Configuration
/// </summary>
protected override void OnConfigurationUpdated()
{
- UpdateItemsByNamePath();
UpdateMetadataPath();
base.OnConfigurationUpdated();
@@ -87,19 +85,6 @@ namespace MediaBrowser.Server.Implementations.Configuration
}
/// <summary>
- /// Updates the items by name path.
- /// </summary>
- private void UpdateItemsByNamePath()
- {
- if (!Configuration.MergeMetadataAndImagesByName)
- {
- ((ServerApplicationPaths)ApplicationPaths).ItemsByNamePath = string.IsNullOrEmpty(Configuration.ItemsByNamePath) ?
- null :
- Configuration.ItemsByNamePath;
- }
- }
-
- /// <summary>
/// Updates the metadata path.
/// </summary>
private void UpdateMetadataPath()
@@ -163,12 +148,36 @@ namespace MediaBrowser.Server.Implementations.Configuration
ValidateItemByNamePath(newConfig);
ValidatePathSubstitutions(newConfig);
ValidateMetadataPath(newConfig);
+ ValidateSslCertificate(newConfig);
EventHelper.FireEventIfNotNull(ConfigurationUpdating, this, new GenericEventArgs<ServerConfiguration> { Argument = newConfig }, Logger);
base.ReplaceConfiguration(newConfiguration);
}
+
+ /// <summary>
+ /// Validates the SSL certificate.
+ /// </summary>
+ /// <param name="newConfig">The new configuration.</param>
+ /// <exception cref="System.IO.DirectoryNotFoundException"></exception>
+ private void ValidateSslCertificate(BaseApplicationConfiguration newConfig)
+ {
+ var serverConfig = (ServerConfiguration)newConfig;
+
+ var newPath = serverConfig.CertificatePath;
+
+ if (!string.IsNullOrWhiteSpace(newPath)
+ && !string.Equals(Configuration.CertificatePath ?? string.Empty, newPath))
+ {
+ // Validate
+ if (!FileSystem.FileExists(newPath))
+ {
+ throw new FileNotFoundException(string.Format("Certificate file '{0}' does not exist.", newPath));
+ }
+ }
+ }
+
private void ValidatePathSubstitutions(ServerConfiguration newConfig)
{
foreach (var map in newConfig.PathSubstitutions)