Amended most configuration settings classes to public POCOs without interfaces, and loaded into services collection via loading the configuration section.
This commit is contained in:
@@ -22,27 +22,27 @@ namespace Umbraco.Configuration
|
||||
var configs = new Configs();
|
||||
|
||||
//configs.Add<ITourSettings>(() => new TourSettings(_configuration));
|
||||
configs.Add<ICoreDebugSettings>(() => new CoreDebugSettings(_configuration));
|
||||
//configs.Add<ICoreDebugSettings>(() => new CoreDebugSettings(_configuration));
|
||||
configs.Add<IRequestHandlerSettings>(() => new RequestHandlerSettings(_configuration));
|
||||
configs.Add<ISecuritySettings>(() => new SecuritySettings(_configuration));
|
||||
configs.Add<IUserPasswordConfiguration>(() => new UserPasswordConfigurationSettings(_configuration));
|
||||
configs.Add<IMemberPasswordConfiguration>(() => new MemberPasswordConfigurationSettings(_configuration));
|
||||
configs.Add<IKeepAliveSettings>(() => new KeepAliveSettings(_configuration));
|
||||
configs.Add<IContentSettings>(() => new ContentSettings(_configuration));
|
||||
//configs.Add<ISecuritySettings>(() => new SecuritySettings(_configuration));
|
||||
//configs.Add<IUserPasswordConfiguration>(() => new UserPasswordConfigurationSettings(_configuration));
|
||||
//configs.Add<IMemberPasswordConfiguration>(() => new MemberPasswordConfigurationSettings(_configuration));
|
||||
//configs.Add<IKeepAliveSettings>(() => new KeepAliveSettings(_configuration));
|
||||
//configs.Add<IContentSettings>(() => new ContentSettings(_configuration));
|
||||
configs.Add<IHealthChecksSettings>(() => new HealthChecksSettings(_configuration));
|
||||
configs.Add<ILoggingSettings>(() => new LoggingSettings(_configuration));
|
||||
configs.Add<IExceptionFilterSettings>(() => new ExceptionFilterSettings(_configuration));
|
||||
configs.Add<IActiveDirectorySettings>(() => new ActiveDirectorySettings(_configuration));
|
||||
configs.Add<IRuntimeSettings>(() => new RuntimeSettings(_configuration));
|
||||
configs.Add<ITypeFinderSettings>(() => new TypeFinderSettings(_configuration));
|
||||
configs.Add<INuCacheSettings>(() => new NuCacheSettings(_configuration));
|
||||
configs.Add<IWebRoutingSettings>(() => new WebRoutingSettings(_configuration));
|
||||
configs.Add<IIndexCreatorSettings>(() => new IndexCreatorSettings(_configuration));
|
||||
configs.Add<IModelsBuilderConfig>(() => new ModelsBuilderConfig(_configuration));
|
||||
configs.Add<IHostingSettings>(() => new HostingSettings(_configuration));
|
||||
configs.Add<IGlobalSettings>(() => new GlobalSettings(_configuration));
|
||||
//configs.Add<ILoggingSettings>(() => new LoggingSettings(_configuration));
|
||||
//configs.Add<IExceptionFilterSettings>(() => new ExceptionFilterSettings(_configuration));
|
||||
//configs.Add<IActiveDirectorySettings>(() => new ActiveDirectorySettings(_configuration));
|
||||
//configs.Add<IRuntimeSettings>(() => new RuntimeSettings(_configuration));
|
||||
//configs.Add<ITypeFinderSettings>(() => new TypeFinderSettings(_configuration));
|
||||
//configs.Add<INuCacheSettings>(() => new NuCacheSettings(_configuration));
|
||||
//configs.Add<IWebRoutingSettings>(() => new WebRoutingSettings(_configuration));
|
||||
//configs.Add<IIndexCreatorSettings>(() => new IndexCreatorSettings(_configuration));
|
||||
//configs.Add<IModelsBuilderConfig>(() => new ModelsBuilderConfig(_configuration));
|
||||
//configs.Add<IHostingSettings>(() => new HostingSettings(_configuration));
|
||||
//configs.Add<IGlobalSettings>(() => new GlobalSettings(_configuration));
|
||||
configs.Add<IConnectionStrings>(() => new ConnectionStrings(_configuration));
|
||||
configs.Add<IImagingSettings>(() => new ImagingSettings(_configuration));
|
||||
//configs.Add<IImagingSettings>(() => new ImagingSettings(_configuration));
|
||||
|
||||
return configs;
|
||||
}
|
||||
|
||||
@@ -1,19 +1,10 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
internal class ActiveDirectorySettings : IActiveDirectorySettings
|
||||
public class ActiveDirectorySettings
|
||||
{
|
||||
private const string Prefix = Constants.Configuration.ConfigPrefix + "ActiveDirectory:";
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public ActiveDirectorySettings(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public string ActiveDirectoryDomain => _configuration.GetValue<string>(Prefix+"Domain");
|
||||
[JsonPropertyName("Domain")]
|
||||
public string ActiveDirectoryDomain { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
36
src/Umbraco.Configuration/Models/ContentImagingSettings.cs
Normal file
36
src/Umbraco.Configuration/Models/ContentImagingSettings.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
public class ContentImagingSettings
|
||||
{
|
||||
private static readonly ImagingAutoFillUploadField[] DefaultImagingAutoFillUploadField =
|
||||
{
|
||||
new ImagingAutoFillUploadField
|
||||
{
|
||||
Alias = Constants.Conventions.Media.File,
|
||||
WidthFieldAlias = Constants.Conventions.Media.Width,
|
||||
HeightFieldAlias = Constants.Conventions.Media.Height,
|
||||
ExtensionFieldAlias = Constants.Conventions.Media.Extension,
|
||||
LengthFieldAlias = Constants.Conventions.Media.Bytes,
|
||||
}
|
||||
};
|
||||
|
||||
public IEnumerable<string> ImageFileTypes { get; set; } = new[] { "jpeg", "jpg", "gif", "bmp", "png", "tiff", "tif" };
|
||||
|
||||
[JsonPropertyName("AutoFillImageProperties")]
|
||||
public IEnumerable<IImagingAutoFillUploadField> ImageAutoFillProperties { get; set; } = DefaultImagingAutoFillUploadField;
|
||||
|
||||
private class ImagingAutoFillUploadField : IImagingAutoFillUploadField
|
||||
{
|
||||
public string Alias { get; set; }
|
||||
public string WidthFieldAlias { get; set; }
|
||||
public string HeightFieldAlias { get; set; }
|
||||
public string LengthFieldAlias { get; set; }
|
||||
public string ExtensionFieldAlias { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
public class ContentNotificationSettings
|
||||
{
|
||||
public string NotificationEmailAddress { get; set; }
|
||||
|
||||
public bool DisableHtmlEmail { get; set; } = false;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
@@ -8,7 +9,7 @@ using Umbraco.Core.Macros;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
internal class ContentSettings : IContentSettings
|
||||
public class ContentSettings
|
||||
{
|
||||
private const string Prefix = Constants.Configuration.ConfigPrefix + "Content:";
|
||||
private const string NotificationsPrefix = Prefix + "Notifications:";
|
||||
@@ -16,64 +17,35 @@ namespace Umbraco.Configuration.Models
|
||||
private const string DefaultPreviewBadge =
|
||||
@"<div id=""umbracoPreviewBadge"" class=""umbraco-preview-badge""><span class=""umbraco-preview-badge__header"">Preview mode</span><a href=""{0}/preview/end?redir={1}"" class=""umbraco-preview-badge__end""><svg viewBox=""0 0 100 100"" xmlns=""http://www.w3.org/2000/svg""><title>Click to end</title><path d=""M5273.1 2400.1v-2c0-2.8-5-4-9.7-4s-9.7 1.3-9.7 4v2a7 7 0 002 4.9l5 4.9c.3.3.4.6.4 1v6.4c0 .4.2.7.6.8l2.9.9c.5.1 1-.2 1-.8v-7.2c0-.4.2-.7.4-1l5.1-5a7 7 0 002-4.9zm-9.7-.1c-4.8 0-7.4-1.3-7.5-1.8.1-.5 2.7-1.8 7.5-1.8s7.3 1.3 7.5 1.8c-.2.5-2.7 1.8-7.5 1.8z""/><path d=""M5268.4 2410.3c-.6 0-1 .4-1 1s.4 1 1 1h4.3c.6 0 1-.4 1-1s-.4-1-1-1h-4.3zM5272.7 2413.7h-4.3c-.6 0-1 .4-1 1s.4 1 1 1h4.3c.6 0 1-.4 1-1s-.4-1-1-1zM5272.7 2417h-4.3c-.6 0-1 .4-1 1s.4 1 1 1h4.3c.6 0 1-.4 1-1 0-.5-.4-1-1-1z""/><path d=""M78.2 13l-8.7 11.7a32.5 32.5 0 11-51.9 25.8c0-10.3 4.7-19.7 12.9-25.8L21.8 13a47 47 0 1056.4 0z""/><path d=""M42.7 2.5h14.6v49.4H42.7z""/></svg></a></div><style type=""text/css"">.umbraco-preview-badge {{position: absolute;top: 1em;right: 1em;display: inline-flex;background: #1b264f;color: #fff;padding: 1em;font-size: 12px;z-index: 99999999;justify-content: center;align-items: center;box-shadow: 0 10px 50px rgba(0, 0, 0, .1), 0 6px 20px rgba(0, 0, 0, .16);line-height: 1;}}.umbraco-preview-badge__header {{font-weight: bold;}}.umbraco-preview-badge__end {{width: 3em;padding: 1em;margin: -1em -1em -1em 2em;display: flex;flex-shrink: 0;align-items: center;align-self: stretch;}}.umbraco-preview-badge__end:hover,.umbraco-preview-badge__end:focus {{background: #f5c1bc;}}.umbraco-preview-badge__end svg {{fill: #fff;width:1em;}}</style>";
|
||||
|
||||
private static readonly ImagingAutoFillUploadField[] DefaultImagingAutoFillUploadField =
|
||||
{
|
||||
new ImagingAutoFillUploadField
|
||||
{
|
||||
Alias = Constants.Conventions.Media.File,
|
||||
WidthFieldAlias = Constants.Conventions.Media.Width,
|
||||
HeightFieldAlias =Constants.Conventions.Media.Height,
|
||||
ExtensionFieldAlias =Constants.Conventions.Media.Extension,
|
||||
LengthFieldAlias =Constants.Conventions.Media.Bytes,
|
||||
}
|
||||
};
|
||||
public ContentNotificationSettings Notifications { get; set; }
|
||||
|
||||
private readonly IConfiguration _configuration;
|
||||
public ContentImagingSettings Imaging { get; set; }
|
||||
|
||||
public ContentSettings(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
public bool ResolveUrlsFromTextString { get; set; } = false;
|
||||
|
||||
public string NotificationEmailAddress =>
|
||||
_configuration.GetValue<string>(NotificationsPrefix+"Email");
|
||||
// TODO: to retain previous configuration structure, this should come from a nested collection,
|
||||
// "Errors:Error404". Although we can use JsonPropertyName to map when the JSON field name differs
|
||||
// from the one in this class, not sure how we'd "flatten" a collection like this.
|
||||
[JsonPropertyName("Error404")]
|
||||
public IEnumerable<IContentErrorPage> Error404Collection { get; set; }
|
||||
|
||||
public bool DisableHtmlEmail =>
|
||||
_configuration.GetValue(NotificationsPrefix+"DisableHtmlEmail", false);
|
||||
// public IEnumerable<IContentErrorPage> Error404Collection => _configuration
|
||||
// .GetSection(Prefix + "Errors:Error404")
|
||||
// .GetChildren()
|
||||
// .Select(x => new ContentErrorPage(x));
|
||||
|
||||
public IEnumerable<string> ImageFileTypes => _configuration.GetValue(
|
||||
ImagingPrefix+"ImageFileTypes", new[] { "jpeg", "jpg", "gif", "bmp", "png", "tiff", "tif" });
|
||||
public string PreviewBadge { get; set; } = DefaultPreviewBadge;
|
||||
|
||||
public IEnumerable<IImagingAutoFillUploadField> ImageAutoFillProperties =>
|
||||
_configuration.GetValue(ImagingPrefix+"AutoFillImageProperties",
|
||||
DefaultImagingAutoFillUploadField);
|
||||
[JsonPropertyName("MacroErrors")]
|
||||
public MacroErrorBehaviour MacroErrorBehaviour { get; set; } = MacroErrorBehaviour.Inline;
|
||||
|
||||
public IEnumerable<string> DisallowedUploadFiles { get; set; } = new[] { "ashx", "aspx", "ascx", "config", "cshtml", "vbhtml", "asmx", "air", "axd" };
|
||||
|
||||
public bool ResolveUrlsFromTextString =>
|
||||
_configuration.GetValue(Prefix+"ResolveUrlsFromTextString", false);
|
||||
public IEnumerable<string> AllowedUploadFiles { get; set; } = Array.Empty<string>();
|
||||
|
||||
public IEnumerable<IContentErrorPage> Error404Collection => _configuration
|
||||
.GetSection(Prefix+"Errors:Error404")
|
||||
.GetChildren()
|
||||
.Select(x => new ContentErrorPage(x));
|
||||
public bool ShowDeprecatedPropertyEditors { get; set; } = false;
|
||||
|
||||
public string PreviewBadge => _configuration.GetValue(Prefix+"PreviewBadge", DefaultPreviewBadge);
|
||||
|
||||
public MacroErrorBehaviour MacroErrorBehaviour =>
|
||||
_configuration.GetValue(Prefix+"MacroErrors", MacroErrorBehaviour.Inline);
|
||||
|
||||
public IEnumerable<string> DisallowedUploadFiles => _configuration.GetValue(
|
||||
Prefix+"DisallowedUploadFiles",
|
||||
new[] { "ashx", "aspx", "ascx", "config", "cshtml", "vbhtml", "asmx", "air", "axd" });
|
||||
|
||||
public IEnumerable<string> AllowedUploadFiles =>
|
||||
_configuration.GetValue(Prefix+"AllowedUploadFiles", Array.Empty<string>());
|
||||
|
||||
public bool ShowDeprecatedPropertyEditors =>
|
||||
_configuration.GetValue(Prefix+"ShowDeprecatedPropertyEditors", false);
|
||||
|
||||
public string LoginBackgroundImage =>
|
||||
_configuration.GetValue(Prefix+"LoginBackgroundImage", "assets/img/login.jpg");
|
||||
public string LoginBackgroundImage { get; set; } = "assets/img/login.jpg";
|
||||
|
||||
private class ContentErrorPage : IContentErrorPage
|
||||
{
|
||||
@@ -106,14 +78,5 @@ namespace Umbraco.Configuration.Models
|
||||
public bool HasContentKey { get; }
|
||||
public string Culture { get; set; }
|
||||
}
|
||||
|
||||
private class ImagingAutoFillUploadField : IImagingAutoFillUploadField
|
||||
{
|
||||
public string Alias { get; set; }
|
||||
public string WidthFieldAlias { get; set; }
|
||||
public string HeightFieldAlias { get; set; }
|
||||
public string LengthFieldAlias { get; set; }
|
||||
public string ExtensionFieldAlias { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,9 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
internal class CoreDebugSettings : ICoreDebugSettings
|
||||
public class CoreDebugSettings
|
||||
{
|
||||
private const string Prefix = Constants.Configuration.ConfigPrefix + "Core:Debug:";
|
||||
private readonly IConfiguration _configuration;
|
||||
public bool LogUncompletedScopes { get; set; } = false;
|
||||
|
||||
public CoreDebugSettings(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public bool LogUncompletedScopes =>
|
||||
_configuration.GetValue(Prefix+"LogUncompletedScopes", false);
|
||||
|
||||
public bool DumpOnTimeoutThreadAbort =>
|
||||
_configuration.GetValue(Prefix+"DumpOnTimeoutThreadAbort", false);
|
||||
public bool DumpOnTimeoutThreadAbort { get; set; } = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,7 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
internal class ExceptionFilterSettings : IExceptionFilterSettings
|
||||
public class ExceptionFilterSettings
|
||||
{
|
||||
private const string Prefix = Constants.Configuration.ConfigPrefix + "ExceptionFilter:";
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public ExceptionFilterSettings(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public bool Disabled => _configuration.GetValue(Prefix+"Disabled", false);
|
||||
public bool Disabled { get; set; } = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Mail;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
@@ -11,91 +6,57 @@ namespace Umbraco.Configuration.Models
|
||||
/// The GlobalSettings Class contains general settings information for the entire Umbraco instance based on information
|
||||
/// from web.config appsettings
|
||||
/// </summary>
|
||||
internal class GlobalSettings : IGlobalSettings
|
||||
public class GlobalSettings
|
||||
{
|
||||
private const string Prefix = Constants.Configuration.ConfigGlobalPrefix;
|
||||
|
||||
internal const string
|
||||
StaticReservedPaths = "~/app_plugins/,~/install/,~/mini-profiler-resources/,"; //must end with a comma!
|
||||
|
||||
internal const string
|
||||
StaticReservedUrls = "~/config/splashes/noNodes.aspx,~/.well-known,"; //must end with a comma!
|
||||
|
||||
private readonly IConfiguration _configuration;
|
||||
public string ReservedUrls { get; set; } = StaticReservedUrls;
|
||||
|
||||
public GlobalSettings(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public string ReservedUrls => _configuration.GetValue(Prefix + "ReservedUrls", StaticReservedUrls);
|
||||
public string ReservedPaths => _configuration.GetValue(Prefix + "ReservedPaths", StaticReservedPaths);
|
||||
public string ReservedPaths { get; set; } = StaticReservedPaths;
|
||||
|
||||
// TODO: https://github.com/umbraco/Umbraco-CMS/issues/4238 - stop having version in web.config appSettings
|
||||
public string ConfigurationStatus
|
||||
{
|
||||
get => _configuration.GetValue<string>(Prefix + "ConfigurationStatus");
|
||||
set => throw new NotImplementedException("We should remove this and only use the value from database");
|
||||
}
|
||||
// TODO: previously this would throw on set, but presumably we can't do that if we do still want this in config.
|
||||
public string ConfigurationStatus { get; set; }
|
||||
|
||||
public int TimeOutInMinutes => _configuration.GetValue(Prefix + "TimeOutInMinutes", 20);
|
||||
public string DefaultUILanguage => _configuration.GetValue(Prefix + "DefaultUILanguage", "en-US");
|
||||
public int TimeOutInMinutes { get; set; } = 20;
|
||||
|
||||
public bool HideTopLevelNodeFromPath =>
|
||||
_configuration.GetValue(Prefix + "HideTopLevelNodeFromPath", false);
|
||||
public string DefaultUILanguage { get; set; } = "en-US";
|
||||
|
||||
public bool UseHttps => _configuration.GetValue(Prefix + "UseHttps", false);
|
||||
public int VersionCheckPeriod => _configuration.GetValue(Prefix + "VersionCheckPeriod", 7);
|
||||
public string UmbracoPath => _configuration.GetValue(Prefix + "UmbracoPath", "~/umbraco");
|
||||
public string UmbracoCssPath => _configuration.GetValue(Prefix + "UmbracoCssPath", "~/css");
|
||||
public bool HideTopLevelNodeFromPath { get; set; } = false;
|
||||
|
||||
public string UmbracoScriptsPath =>
|
||||
_configuration.GetValue(Prefix + "UmbracoScriptsPath", "~/scripts");
|
||||
public bool UseHttps { get; set; } = false;
|
||||
|
||||
public string UmbracoMediaPath => _configuration.GetValue(Prefix + "UmbracoMediaPath", "~/media");
|
||||
public int VersionCheckPeriod { get; set; } = 7;
|
||||
|
||||
public bool InstallMissingDatabase =>
|
||||
_configuration.GetValue(Prefix + "InstallMissingDatabase", false);
|
||||
public string UmbracoPath { get; set; } = "~/umbraco";
|
||||
|
||||
public bool InstallEmptyDatabase => _configuration.GetValue(Prefix + "InstallEmptyDatabase", false);
|
||||
public string UmbracoCssPath { get; set; } = "~/css";
|
||||
|
||||
public bool DisableElectionForSingleServer =>
|
||||
_configuration.GetValue(Prefix + "DisableElectionForSingleServer", false);
|
||||
public string UmbracoScriptsPath { get; set; } = "~/scripts";
|
||||
|
||||
public string RegisterType => _configuration.GetValue(Prefix + "RegisterType", string.Empty);
|
||||
public string UmbracoMediaPath { get; set; } = "~/media";
|
||||
|
||||
public string DatabaseFactoryServerVersion =>
|
||||
_configuration.GetValue(Prefix + "DatabaseFactoryServerVersion", string.Empty);
|
||||
public bool InstallMissingDatabase { get; set; } = false;
|
||||
|
||||
public string MainDomLock => _configuration.GetValue(Prefix + "MainDomLock", string.Empty);
|
||||
public bool InstallEmptyDatabase { get; set; } = false;
|
||||
|
||||
public string NoNodesViewPath =>
|
||||
_configuration.GetValue(Prefix + "NoNodesViewPath", "~/config/splashes/NoNodes.cshtml");
|
||||
public bool DisableElectionForSingleServer { get; set; } = false;
|
||||
|
||||
public bool IsSmtpServerConfigured =>
|
||||
_configuration.GetSection(Constants.Configuration.ConfigGlobalPrefix + "Smtp")?.GetChildren().Any() ?? false;
|
||||
public string RegisterType { get; set; } = string.Empty;
|
||||
|
||||
public ISmtpSettings SmtpSettings =>
|
||||
new SmtpSettingsImpl(_configuration.GetSection(Constants.Configuration.ConfigGlobalPrefix + "Smtp"));
|
||||
public string DatabaseFactoryServerVersion { get; set; } = string.Empty;
|
||||
|
||||
private class SmtpSettingsImpl : ISmtpSettings
|
||||
{
|
||||
private readonly IConfigurationSection _configurationSection;
|
||||
public string MainDomLock { get; set; } = string.Empty;
|
||||
|
||||
public SmtpSettingsImpl(IConfigurationSection configurationSection)
|
||||
{
|
||||
_configurationSection = configurationSection;
|
||||
}
|
||||
public string NoNodesViewPath { get; set; } = "~/config/splashes/NoNodes.cshtml";
|
||||
|
||||
public string From => _configurationSection.GetValue<string>("From");
|
||||
public string Host => _configurationSection.GetValue<string>("Host");
|
||||
public int Port => _configurationSection.GetValue<int>("Port");
|
||||
public string PickupDirectoryLocation => _configurationSection.GetValue<string>("PickupDirectoryLocation");
|
||||
public SmtpDeliveryMethod DeliveryMethod => _configurationSection.GetValue<SmtpDeliveryMethod>("DeliveryMethod");
|
||||
public bool IsSmtpServerConfigured => !string.IsNullOrWhiteSpace(SmtpSettings?.Host);
|
||||
|
||||
public string Username => _configurationSection.GetValue<string>("Username");
|
||||
|
||||
public string Password => _configurationSection.GetValue<string>("Password");
|
||||
}
|
||||
[JsonPropertyName("Smtp")]
|
||||
public SmtpSettings SmtpSettings { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,17 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
internal class HostingSettings : IHostingSettings
|
||||
public class HostingSettings
|
||||
{
|
||||
private const string Prefix = Constants.Configuration.ConfigPrefix + "Hosting:";
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public HostingSettings(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public LocalTempStorage LocalTempStorageLocation =>
|
||||
_configuration.GetValue(Prefix+"LocalTempStorage", LocalTempStorage.Default);
|
||||
/// <summary>
|
||||
/// Gets the configuration for the location of temporary files.
|
||||
/// </summary>
|
||||
[JsonPropertyName("LocalTempStorage")]
|
||||
public LocalTempStorage LocalTempStorageLocation { get; set; } = LocalTempStorage.Default;
|
||||
|
||||
public string ApplicationVirtualPath => null;
|
||||
|
||||
@@ -24,6 +19,7 @@ namespace Umbraco.Configuration.Models
|
||||
/// Gets a value indicating whether umbraco is running in [debug mode].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [debug mode]; otherwise, <c>false</c>.</value>
|
||||
public bool DebugMode => _configuration.GetValue(Prefix+"Debug", false);
|
||||
[JsonPropertyName("Debug")]
|
||||
public bool DebugMode { get; set; } = false;
|
||||
}
|
||||
}
|
||||
|
||||
16
src/Umbraco.Configuration/Models/ImagingCacheSettings.cs
Normal file
16
src/Umbraco.Configuration/Models/ImagingCacheSettings.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
public class ImagingCacheSettings
|
||||
{
|
||||
public int MaxBrowserCacheDays { get; set; } = 7;
|
||||
|
||||
public int MaxCacheDays { get; set; } = 365;
|
||||
|
||||
public uint CachedNameLength { get; set; } = 7;
|
||||
|
||||
[JsonPropertyName("Folder")]
|
||||
public string CacheFolder { get; set; } = "../App_Data/Cache";
|
||||
}
|
||||
}
|
||||
13
src/Umbraco.Configuration/Models/ImagingResizeSettings.cs
Normal file
13
src/Umbraco.Configuration/Models/ImagingResizeSettings.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
public class ImagingResizeSettings
|
||||
{
|
||||
[JsonPropertyName("MaxWidth")]
|
||||
public int MaxResizeWidth { get; set; } = 5000;
|
||||
|
||||
[JsonPropertyName("MaxHeight")]
|
||||
public int MaxResizeHeight { get; set; } = 5000;
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,9 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
internal class ImagingSettings : IImagingSettings
|
||||
public class ImagingSettings
|
||||
{
|
||||
private const string Prefix = Constants.Configuration.ConfigPrefix + "Imaging:";
|
||||
private const string CachePrefix = Prefix + "Cache:";
|
||||
private const string ResizePrefix = Prefix + "Resize:";
|
||||
private readonly IConfiguration _configuration;
|
||||
public ImagingCacheSettings Cache { get; set; }
|
||||
|
||||
public ImagingSettings(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public int MaxBrowserCacheDays => _configuration.GetValue(CachePrefix + "MaxBrowserCacheDays", 7);
|
||||
public int MaxCacheDays => _configuration.GetValue(CachePrefix + "MaxCacheDays", 365);
|
||||
public uint CachedNameLength => _configuration.GetValue(CachePrefix + "CachedNameLength", (uint) 8);
|
||||
public string CacheFolder => _configuration.GetValue(CachePrefix + "Folder", "../App_Data/Cache");
|
||||
public int MaxResizeWidth => _configuration.GetValue(ResizePrefix + "MaxWidth", 5000);
|
||||
public int MaxResizeHeight => _configuration.GetValue(ResizePrefix + "MaxHeight", 5000);
|
||||
public ImagingResizeSettings Resize { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,7 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
internal class IndexCreatorSettings : IIndexCreatorSettings
|
||||
public class IndexCreatorSettings
|
||||
{
|
||||
private const string Prefix = Constants.Configuration.ConfigPrefix + "Examine:";
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public IndexCreatorSettings(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public string LuceneDirectoryFactory =>
|
||||
_configuration.GetValue<string>(Prefix + "LuceneDirectoryFactory");
|
||||
public string LuceneDirectoryFactory { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,11 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
internal class KeepAliveSettings : IKeepAliveSettings
|
||||
public class KeepAliveSettings : IKeepAliveSettings
|
||||
{
|
||||
private const string Prefix = Constants.Configuration.ConfigPrefix + "KeepAlive:";
|
||||
private readonly IConfiguration _configuration;
|
||||
public bool DisableKeepAliveTask { get; set; } = false;
|
||||
|
||||
public KeepAliveSettings(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public bool DisableKeepAliveTask =>
|
||||
_configuration.GetValue(Prefix + "DisableKeepAliveTask", false);
|
||||
|
||||
public string KeepAlivePingUrl => _configuration.GetValue(Prefix + "KeepAlivePingUrl",
|
||||
"{umbracoApplicationUrl}/api/keepalive/ping");
|
||||
public string KeepAlivePingUrl { get; set; } = "{umbracoApplicationUrl}/api/keepalive/ping";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,7 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
internal class LoggingSettings : ILoggingSettings
|
||||
public class LoggingSettings
|
||||
{
|
||||
private const string Prefix = Constants.Configuration.ConfigPrefix + "Logging:";
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public LoggingSettings(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public int MaxLogAge => _configuration.GetValue(Prefix + "MaxLogAge", -1);
|
||||
public int MaxLogAge { get; set; } = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +1,21 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
internal class MemberPasswordConfigurationSettings : IMemberPasswordConfiguration
|
||||
public class MemberPasswordConfigurationSettings
|
||||
{
|
||||
private const string Prefix = Constants.Configuration.ConfigSecurityPrefix + "MemberPassword:";
|
||||
private readonly IConfiguration _configuration;
|
||||
public int RequiredLength { get; set; } = 10;
|
||||
|
||||
public MemberPasswordConfigurationSettings(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
public bool RequireNonLetterOrDigit { get; set; } = false;
|
||||
|
||||
public int RequiredLength =>
|
||||
_configuration.GetValue(Prefix + "RequiredLength", 10);
|
||||
public bool RequireDigit { get; set; } = false;
|
||||
|
||||
public bool RequireNonLetterOrDigit =>
|
||||
_configuration.GetValue(Prefix + "RequireNonLetterOrDigit", false);
|
||||
public bool RequireLowercase { get; set; } = false;
|
||||
|
||||
public bool RequireDigit =>
|
||||
_configuration.GetValue(Prefix + "RequireDigit", false);
|
||||
public bool RequireUppercase { get; set; } = false;
|
||||
|
||||
public bool RequireLowercase =>
|
||||
_configuration.GetValue(Prefix + "RequireLowercase", false);
|
||||
public string HashAlgorithmType { get; set; } = Constants.Security.AspNetUmbraco8PasswordHashAlgorithmName;
|
||||
|
||||
public bool RequireUppercase =>
|
||||
_configuration.GetValue(Prefix + "RequireUppercase", false);
|
||||
|
||||
public string HashAlgorithmType =>
|
||||
_configuration.GetValue(Prefix + "HashAlgorithmType", Constants.Security.AspNetUmbraco8PasswordHashAlgorithmName); // TODO: Need to change to current format when we do members
|
||||
|
||||
public int MaxFailedAccessAttemptsBeforeLockout =>
|
||||
_configuration.GetValue(Prefix + "MaxFailedAccessAttemptsBeforeLockout", 5);
|
||||
public int MaxFailedAccessAttemptsBeforeLockout { get; set; } = 5;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,20 +7,9 @@ namespace Umbraco.Configuration.Models
|
||||
/// <summary>
|
||||
/// Represents the models builder configuration.
|
||||
/// </summary>
|
||||
internal class ModelsBuilderConfig : IModelsBuilderConfig
|
||||
public class ModelsBuilderConfig
|
||||
{
|
||||
private const string Prefix = Constants.Configuration.ConfigModelsBuilderPrefix;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ModelsBuilderConfig" /> class.
|
||||
/// </summary>
|
||||
public ModelsBuilderConfig(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public string DefaultModelsDirectory => "~/App_Data/Models";
|
||||
public static string DefaultModelsDirectory => "~/App_Data/Models";
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the whole models experience is enabled.
|
||||
@@ -29,25 +18,26 @@ namespace Umbraco.Configuration.Models
|
||||
/// <para>If this is false then absolutely nothing happens.</para>
|
||||
/// <para>Default value is <c>false</c> which means that unless we have this setting, nothing happens.</para>
|
||||
/// </remarks>
|
||||
public bool Enable => _configuration.GetValue(Prefix+"Enable", false);
|
||||
public bool Enable { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the models mode.
|
||||
/// </summary>
|
||||
public ModelsMode ModelsMode =>
|
||||
_configuration.GetValue(Prefix+"ModelsMode", ModelsMode.Nothing);
|
||||
public ModelsMode ModelsMode { get; set; } = ModelsMode.Nothing;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the models namespace.
|
||||
/// </summary>
|
||||
/// <remarks>That value could be overriden by other (attribute in user's code...). Return default if no value was supplied.</remarks>
|
||||
public string ModelsNamespace => _configuration.GetValue<string>(Prefix+"ModelsNamespace");
|
||||
public string ModelsNamespace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether we should enable the models factory.
|
||||
/// </summary>
|
||||
/// <remarks>Default value is <c>true</c> because no factory is enabled by default in Umbraco.</remarks>
|
||||
public bool EnableFactory => _configuration.GetValue(Prefix+"EnableFactory", true);
|
||||
public bool EnableFactory { get; set; } = true;
|
||||
|
||||
private bool _flagOutOfDateModels;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether we should flag out-of-date models.
|
||||
@@ -57,15 +47,26 @@ namespace Umbraco.Configuration.Models
|
||||
/// setting is activated the ~/App_Data/Models/ood.txt file is then created. When models are
|
||||
/// generated through the dashboard, the files is cleared. Default value is <c>false</c>.
|
||||
/// </remarks>
|
||||
public bool FlagOutOfDateModels =>
|
||||
_configuration.GetValue(Prefix+"FlagOutOfDateModels", false) && !ModelsMode.IsLive();
|
||||
public bool FlagOutOfDateModels
|
||||
{
|
||||
get => _flagOutOfDateModels;
|
||||
|
||||
set
|
||||
{
|
||||
if (!ModelsMode.IsLive())
|
||||
{
|
||||
_flagOutOfDateModels = false;
|
||||
}
|
||||
|
||||
_flagOutOfDateModels = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the models directory.
|
||||
/// </summary>
|
||||
/// <remarks>Default is ~/App_Data/Models but that can be changed.</remarks>
|
||||
public string ModelsDirectory =>
|
||||
_configuration.GetValue(Prefix+"ModelsDirectory", "~/App_Data/Models");
|
||||
public string ModelsDirectory { get; set; } = DefaultModelsDirectory;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether to accept an unsafe value for ModelsDirectory.
|
||||
@@ -74,13 +75,12 @@ namespace Umbraco.Configuration.Models
|
||||
/// An unsafe value is an absolute path, or a relative path pointing outside
|
||||
/// of the website root.
|
||||
/// </remarks>
|
||||
public bool AcceptUnsafeModelsDirectory =>
|
||||
_configuration.GetValue(Prefix+"AcceptUnsafeModelsDirectory", false);
|
||||
public bool AcceptUnsafeModelsDirectory { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating the debug log level.
|
||||
/// </summary>
|
||||
/// <remarks>0 means minimal (safe on live site), anything else means more and more details (maybe not safe).</remarks>
|
||||
public int DebugLevel => _configuration.GetValue(Prefix+"DebugLevel", 0);
|
||||
public int DebugLevel { get; set; } = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,7 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
internal class NuCacheSettings : INuCacheSettings
|
||||
public class NuCacheSettings
|
||||
{
|
||||
private const string Prefix = Constants.Configuration.ConfigPrefix + "NuCache:";
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public NuCacheSettings(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public string BTreeBlockSize => _configuration.GetValue<string>(Prefix+"BTreeBlockSize");
|
||||
public string BTreeBlockSize { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,9 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
internal class RuntimeSettings : IRuntimeSettings
|
||||
public class RuntimeSettings
|
||||
{
|
||||
private const string Prefix = Constants.Configuration.ConfigPrefix + "Runtime:";
|
||||
private readonly IConfiguration _configuration;
|
||||
public RuntimeSettings(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
public int? MaxQueryStringLength { get; set; }
|
||||
|
||||
public int? MaxQueryStringLength => _configuration.GetValue<int?>(Prefix+"MaxRequestLength");
|
||||
public int? MaxRequestLength => _configuration.GetValue<int?>(Prefix+"MaxRequestLength");
|
||||
public int? MaxRequestLength { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,33 +1,17 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
internal class SecuritySettings : ISecuritySettings
|
||||
public class SecuritySettings
|
||||
{
|
||||
private const string Prefix = Constants.Configuration.ConfigSecurityPrefix;
|
||||
private readonly IConfiguration _configuration;
|
||||
public bool KeepUserLoggedIn { get; set; } = false;
|
||||
|
||||
public SecuritySettings(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
public bool HideDisabledUsersInBackoffice { get; set; } = false;
|
||||
|
||||
public bool KeepUserLoggedIn => _configuration.GetValue(Prefix + "KeepUserLoggedIn", false);
|
||||
public bool AllowPasswordReset { get; set; } = true;
|
||||
|
||||
public bool HideDisabledUsersInBackoffice =>
|
||||
_configuration.GetValue(Prefix + "HideDisabledUsersInBackoffice", false);
|
||||
public string AuthCookieName { get; set; } = "UMB_UCONTEXT";
|
||||
|
||||
public bool AllowPasswordReset =>
|
||||
_configuration.GetValue(Prefix + "AllowPasswordResetAllowPasswordReset", true);
|
||||
public string AuthCookieDomain { get; set; }
|
||||
|
||||
public string AuthCookieName =>
|
||||
_configuration.GetValue(Prefix + "AuthCookieName", "UMB_UCONTEXT");
|
||||
|
||||
public string AuthCookieDomain =>
|
||||
_configuration.GetValue<string>(Prefix + "AuthCookieDomain");
|
||||
|
||||
public bool UsernameIsEmail => _configuration.GetValue(Prefix + "UsernameIsEmail", true);
|
||||
public bool UsernameIsEmail { get; set; } = true;
|
||||
}
|
||||
}
|
||||
|
||||
21
src/Umbraco.Configuration/Models/SmtpSettings.cs
Normal file
21
src/Umbraco.Configuration/Models/SmtpSettings.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Net.Mail;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
public class SmtpSettings
|
||||
{
|
||||
public string From { get; set; }
|
||||
|
||||
public string Host { get; set; }
|
||||
|
||||
public int Port { get; set; }
|
||||
|
||||
public string PickupDirectoryLocation { get; set; }
|
||||
|
||||
public SmtpDeliveryMethod DeliveryMethod { get; set; }
|
||||
|
||||
public string Username { get; set; }
|
||||
|
||||
public string Password { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,7 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
internal class TypeFinderSettings : ITypeFinderSettings
|
||||
public class TypeFinderSettings
|
||||
{
|
||||
private const string Prefix = Constants.Configuration.ConfigPrefix + "TypeFinder:";
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public TypeFinderSettings(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public string AssembliesAcceptingLoadExceptions =>
|
||||
_configuration.GetValue<string>(Prefix+"AssembliesAcceptingLoadExceptions");
|
||||
public string AssembliesAcceptingLoadExceptions { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +1,22 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
internal class UserPasswordConfigurationSettings : IUserPasswordConfiguration
|
||||
public class UserPasswordConfigurationSettings
|
||||
{
|
||||
private const string Prefix = Constants.Configuration.ConfigSecurityPrefix + "UserPassword:";
|
||||
private readonly IConfiguration _configuration;
|
||||
public int RequiredLength { get; set; } = 10;
|
||||
|
||||
public UserPasswordConfigurationSettings(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
public bool RequireNonLetterOrDigit { get; set; } = false;
|
||||
|
||||
public int RequiredLength => _configuration.GetValue(Prefix + "RequiredLength", 10);
|
||||
public bool RequireDigit { get; set; } = false;
|
||||
|
||||
public bool RequireNonLetterOrDigit =>
|
||||
_configuration.GetValue(Prefix + "RequireNonLetterOrDigit", false);
|
||||
public bool RequireLowercase { get; set; } = false;
|
||||
|
||||
public bool RequireDigit => _configuration.GetValue(Prefix + "RequireDigit", false);
|
||||
public bool RequireUppercase { get; set; } = false;
|
||||
|
||||
public bool RequireLowercase =>
|
||||
_configuration.GetValue(Prefix + "RequireLowercase", false);
|
||||
public string HashAlgorithmType { get; set; } = Constants.Security.AspNetCoreV3PasswordHashAlgorithmName;
|
||||
|
||||
public bool RequireUppercase =>
|
||||
_configuration.GetValue(Prefix + "RequireUppercase", false);
|
||||
|
||||
public string HashAlgorithmType =>
|
||||
_configuration.GetValue(Prefix + "HashAlgorithmType", Constants.Security.AspNetCoreV3PasswordHashAlgorithmName);
|
||||
|
||||
public int MaxFailedAccessAttemptsBeforeLockout =>
|
||||
_configuration.GetValue(Prefix + "MaxFailedAccessAttemptsBeforeLockout", 5);
|
||||
public int MaxFailedAccessAttemptsBeforeLockout { get; set; } = 5;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,42 +1,23 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration.UmbracoSettings;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
using Umbraco.Core.Models.PublishedContent;
|
||||
|
||||
namespace Umbraco.Configuration.Models
|
||||
{
|
||||
internal class WebRoutingSettings : IWebRoutingSettings
|
||||
public class WebRoutingSettings
|
||||
{
|
||||
private const string Prefix = Constants.Configuration.ConfigPrefix + "WebRouting:";
|
||||
private readonly IConfiguration _configuration;
|
||||
public bool TrySkipIisCustomErrors { get; set; } = false;
|
||||
|
||||
public WebRoutingSettings(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
public bool InternalRedirectPreservesTemplate { get; set; } = false;
|
||||
|
||||
public bool TrySkipIisCustomErrors =>
|
||||
_configuration.GetValue(Prefix + "TrySkipIisCustomErrors", false);
|
||||
public bool DisableAlternativeTemplates { get; set; } = false;
|
||||
|
||||
public bool InternalRedirectPreservesTemplate =>
|
||||
_configuration.GetValue(Prefix + "InternalRedirectPreservesTemplate", false);
|
||||
public bool ValidateAlternativeTemplates { get; set; } = false;
|
||||
|
||||
public bool DisableAlternativeTemplates =>
|
||||
_configuration.GetValue(Prefix + "DisableAlternativeTemplates", false);
|
||||
public bool DisableFindContentByIdPath { get; set; } = false;
|
||||
|
||||
public bool ValidateAlternativeTemplates =>
|
||||
_configuration.GetValue(Prefix + "ValidateAlternativeTemplates", false);
|
||||
public bool DisableRedirectUrlTracking { get; set; } = false;
|
||||
|
||||
public bool DisableFindContentByIdPath =>
|
||||
_configuration.GetValue(Prefix + "DisableFindContentByIdPath", false);
|
||||
public string UrlProviderMode { get; set; } = UrlMode.Auto.ToString();
|
||||
|
||||
public bool DisableRedirectUrlTracking =>
|
||||
_configuration.GetValue(Prefix + "DisableRedirectUrlTracking", false);
|
||||
|
||||
public string UrlProviderMode =>
|
||||
_configuration.GetValue(Prefix + "UrlProviderMode", UrlMode.Auto.ToString());
|
||||
|
||||
public string UmbracoApplicationUrl =>
|
||||
_configuration.GetValue<string>(Prefix + "UmbracoApplicationUrl");
|
||||
public string UmbracoApplicationUrl { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
using System;
|
||||
using System.Data.Common;
|
||||
using System.Data.SqlClient;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
@@ -28,13 +25,11 @@ using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
using Umbraco.Core.Runtime;
|
||||
using Umbraco.Web.Common.AspNetCore;
|
||||
using Umbraco.Web.Common.Extensions;
|
||||
using Umbraco.Web.Common.Profiler;
|
||||
using CoreDebugSettings = Umbraco.Configuration.Models.CoreDebugSettings;
|
||||
|
||||
namespace Umbraco.Extensions
|
||||
{
|
||||
|
||||
|
||||
public static class UmbracoCoreServiceCollectionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
@@ -107,6 +102,24 @@ namespace Umbraco.Extensions
|
||||
if (configuration == null) throw new ArgumentNullException(nameof(configuration));
|
||||
|
||||
services.Configure<TourSettings>(configuration.GetSection(Constants.Configuration.ConfigPrefix + "Tours"));
|
||||
services.Configure<CoreDebugSettings>(configuration.GetSection(Constants.Configuration.ConfigPrefix + "Core:Debug"));
|
||||
services.Configure<SecuritySettings>(configuration.GetSection(Constants.Configuration.ConfigSecurityPrefix));
|
||||
services.Configure<UserPasswordConfigurationSettings>(configuration.GetSection(Constants.Configuration.ConfigSecurityPrefix + "UserPassword:"));
|
||||
services.Configure<MemberPasswordConfigurationSettings>(configuration.GetSection(Constants.Configuration.ConfigSecurityPrefix + "MemberPassword:"));
|
||||
services.Configure<KeepAliveSettings>(configuration.GetSection(Constants.Configuration.ConfigPrefix + "KeepAlive:"));
|
||||
services.Configure<ContentSettings>(configuration.GetSection(Constants.Configuration.ConfigPrefix + "Content:"));
|
||||
services.Configure<LoggingSettings>(configuration.GetSection(Constants.Configuration.ConfigPrefix + "Logging:"));
|
||||
services.Configure<ExceptionFilterSettings>(configuration.GetSection(Constants.Configuration.ConfigPrefix + "ExceptionFilter:"));
|
||||
services.Configure<ActiveDirectorySettings>(configuration.GetSection(Constants.Configuration.ConfigPrefix + "ActiveDirectory:"));
|
||||
services.Configure<RuntimeSettings>(configuration.GetSection(Constants.Configuration.ConfigPrefix + "Runtime:"));
|
||||
services.Configure<RuntimeSettings>(configuration.GetSection(Constants.Configuration.ConfigPrefix + "TypeFinder:"));
|
||||
services.Configure<NuCacheSettings>(configuration.GetSection(Constants.Configuration.ConfigPrefix + "NuCache:"));
|
||||
services.Configure<WebRoutingSettings>(configuration.GetSection(Constants.Configuration.ConfigPrefix + "WebRouting:"));
|
||||
services.Configure<IndexCreatorSettings>(configuration.GetSection(Constants.Configuration.ConfigPrefix + "Examine:"));
|
||||
services.Configure<ModelsBuilderConfig>(configuration.GetSection(Constants.Configuration.ConfigModelsBuilderPrefix));
|
||||
services.Configure<HostingSettings>(configuration.GetSection(Constants.Configuration.ConfigPrefix + "Hosting:"));
|
||||
services.Configure<GlobalSettings>(configuration.GetSection(Constants.Configuration.ConfigGlobalPrefix));
|
||||
services.Configure<ImagingSettings>(configuration.GetSection(Constants.Configuration.ConfigPrefix + "Imaging:"));
|
||||
|
||||
var configsFactory = new AspNetCoreConfigsFactory(configuration);
|
||||
var configs = configsFactory.Create();
|
||||
|
||||
Reference in New Issue
Block a user