diff --git a/src/Umbraco.Core/Configuration/Models/ContentImagingSettings.cs b/src/Umbraco.Core/Configuration/Models/ContentImagingSettings.cs index ee21484dab..990b3c61cb 100644 --- a/src/Umbraco.Core/Configuration/Models/ContentImagingSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/ContentImagingSettings.cs @@ -1,6 +1,9 @@ // Copyright (c) Umbraco. // See LICENSE for more details. +using System; +using System.ComponentModel; + namespace Umbraco.Cms.Core.Configuration.Models { /// @@ -20,10 +23,13 @@ namespace Umbraco.Cms.Core.Configuration.Models } }; + internal const string StaticImageFileTypes = "jpeg,jpg,gif,bmp,png,tiff,tif"; + /// /// Gets or sets a value for the collection of accepted image file extensions. /// - public string[] ImageFileTypes { get; set; } = new[] { "jpeg", "jpg", "gif", "bmp", "png", "tiff", "tif" }; + [DefaultValue(StaticImageFileTypes)] + public string[] ImageFileTypes { get; set; } = StaticImageFileTypes.Split(','); /// /// Gets or sets a value for the imaging autofill following media file upload fields. diff --git a/src/Umbraco.Core/Configuration/Models/ContentNotificationSettings.cs b/src/Umbraco.Core/Configuration/Models/ContentNotificationSettings.cs index 2fa92eb4b5..b4ae2b34a1 100644 --- a/src/Umbraco.Core/Configuration/Models/ContentNotificationSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/ContentNotificationSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) Umbraco. // See LICENSE for more details. +using System.ComponentModel; + namespace Umbraco.Cms.Core.Configuration.Models { /// @@ -8,6 +10,8 @@ namespace Umbraco.Cms.Core.Configuration.Models /// public class ContentNotificationSettings { + internal const bool StaticDisableHtmlEmail = false; + /// /// Gets or sets a value for the email address for notifications. /// @@ -16,6 +20,7 @@ namespace Umbraco.Cms.Core.Configuration.Models /// /// Gets or sets a value indicating whether HTML email notifications should be disabled. /// - public bool DisableHtmlEmail { get; set; } = false; + [DefaultValue(StaticDisableHtmlEmail)] + public bool DisableHtmlEmail { get; set; } = StaticDisableHtmlEmail; } } diff --git a/src/Umbraco.Core/Configuration/Models/ContentSettings.cs b/src/Umbraco.Core/Configuration/Models/ContentSettings.cs index 1c54593ed2..dcca8c2adb 100644 --- a/src/Umbraco.Core/Configuration/Models/ContentSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/ContentSettings.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using Umbraco.Cms.Core.Macros; namespace Umbraco.Cms.Core.Configuration.Models @@ -13,7 +14,9 @@ namespace Umbraco.Cms.Core.Configuration.Models [UmbracoOptions(Constants.Configuration.ConfigContent)] public class ContentSettings { - private const string DefaultPreviewBadge = + + internal const bool StaticResolveUrlsFromTextString = false; + internal const string StaticDefaultPreviewBadge = @"
Preview mode @@ -148,6 +151,12 @@ namespace Umbraco.Cms.Core.Configuration.Models "; + internal const string StaticMacroErrors = "Inline"; + internal const string StaticDisallowedUploadFiles = "ashx,aspx,ascx,config,cshtml,vbhtml,asmx,air,axd,xamlx"; + internal const bool StaticShowDeprecatedPropertyEditors = false; + internal const string StaticLoginBackgroundImage = "assets/img/login.jpg"; + internal const string StaticLoginLogoImage = "assets/img/application/umbraco_logo_white.svg"; + /// /// Gets or sets a value for the content notification settings. /// @@ -161,7 +170,8 @@ namespace Umbraco.Cms.Core.Configuration.Models /// /// Gets or sets a value indicating whether URLs should be resolved from text strings. /// - public bool ResolveUrlsFromTextString { get; set; } = false; + [DefaultValue(StaticResolveUrlsFromTextString)] + public bool ResolveUrlsFromTextString { get; set; } = StaticResolveUrlsFromTextString; /// /// Gets or sets a value for the collection of error pages. @@ -171,17 +181,20 @@ namespace Umbraco.Cms.Core.Configuration.Models /// /// Gets or sets a value for the preview badge mark-up. /// - public string PreviewBadge { get; set; } = DefaultPreviewBadge; + [DefaultValue(StaticDefaultPreviewBadge)] + public string PreviewBadge { get; set; } = StaticDefaultPreviewBadge; /// /// Gets or sets a value for the macro error behaviour. /// - public MacroErrorBehaviour MacroErrors { get; set; } = MacroErrorBehaviour.Inline; + [DefaultValue(StaticMacroErrors)] + public MacroErrorBehaviour MacroErrors { get; set; } = Enum.Parse(StaticMacroErrors); /// /// Gets or sets a value for the collection of file extensions that are disallowed for upload. /// - public IEnumerable DisallowedUploadFiles { get; set; } = new[] { "ashx", "aspx", "ascx", "config", "cshtml", "vbhtml", "asmx", "air", "axd", "xamlx" }; + [DefaultValue(StaticDisallowedUploadFiles)] + public IEnumerable DisallowedUploadFiles { get; set; } = StaticDisallowedUploadFiles.Split(','); /// /// Gets or sets a value for the collection of file extensions that are allowed for upload. @@ -191,17 +204,20 @@ namespace Umbraco.Cms.Core.Configuration.Models /// /// Gets or sets a value indicating whether deprecated property editors should be shown. /// - public bool ShowDeprecatedPropertyEditors { get; set; } = false; + [DefaultValue(StaticShowDeprecatedPropertyEditors)] + public bool ShowDeprecatedPropertyEditors { get; set; } = StaticShowDeprecatedPropertyEditors; /// /// Gets or sets a value for the path to the login screen background image. /// - public string LoginBackgroundImage { get; set; } = "assets/img/login.jpg"; + [DefaultValue(StaticLoginBackgroundImage)] + public string LoginBackgroundImage { get; set; } = StaticLoginBackgroundImage; /// /// Gets or sets a value for the path to the login screen logo image. /// - public string LoginLogoImage { get; set; } = "assets/img/application/umbraco_logo_white.svg"; + [DefaultValue(StaticLoginLogoImage)] + public string LoginLogoImage { get; set; } = StaticLoginLogoImage; } diff --git a/src/Umbraco.Core/Configuration/Models/CoreDebugSettings.cs b/src/Umbraco.Core/Configuration/Models/CoreDebugSettings.cs index 626a4c68f7..58810a3462 100644 --- a/src/Umbraco.Core/Configuration/Models/CoreDebugSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/CoreDebugSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) Umbraco. // See LICENSE for more details. +using System.ComponentModel; + namespace Umbraco.Cms.Core.Configuration.Models { /// @@ -9,14 +11,19 @@ namespace Umbraco.Cms.Core.Configuration.Models [UmbracoOptions(Constants.Configuration.ConfigCoreDebug)] public class CoreDebugSettings { + internal const bool StaticLogIncompletedScopes = false; + internal const bool StaticDumpOnTimeoutThreadAbort = false; + /// /// Gets or sets a value indicating whether incompleted scopes should be logged. /// - public bool LogIncompletedScopes { get; set; } = false; + [DefaultValue(StaticLogIncompletedScopes)] + public bool LogIncompletedScopes { get; set; } = StaticLogIncompletedScopes; /// /// Gets or sets a value indicating whether memory dumps on thread abort should be taken. /// - public bool DumpOnTimeoutThreadAbort { get; set; } = false; + [DefaultValue(StaticDumpOnTimeoutThreadAbort)] + public bool DumpOnTimeoutThreadAbort { get; set; } = StaticDumpOnTimeoutThreadAbort; } } diff --git a/src/Umbraco.Core/Configuration/Models/DatabaseServerMessengerSettings.cs b/src/Umbraco.Core/Configuration/Models/DatabaseServerMessengerSettings.cs index d2afea19e7..f1320a199f 100644 --- a/src/Umbraco.Core/Configuration/Models/DatabaseServerMessengerSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/DatabaseServerMessengerSettings.cs @@ -2,6 +2,7 @@ // See LICENSE for more details. using System; +using System.ComponentModel; namespace Umbraco.Cms.Core.Configuration.Models { @@ -10,24 +11,33 @@ namespace Umbraco.Cms.Core.Configuration.Models /// public class DatabaseServerMessengerSettings { + internal const int StaticMaxProcessingInstructionCount = 1000; + internal const string StaticTimeToRetainInstructions = "2.00:00:00"; // TimeSpan.FromDays(2); + internal const string StaticTimeBetweenSyncOperations = "00:00:05"; // TimeSpan.FromSeconds(5); + internal const string StaticTimeBetweenPruneOperations = "00:01:00"; // TimeSpan.FromMinutes(1); + /// /// Gets or sets a value for the maximum number of instructions that can be processed at startup; otherwise the server cold-boots (rebuilds its caches). /// - public int MaxProcessingInstructionCount { get; set; } = 1000; + [DefaultValue(StaticMaxProcessingInstructionCount)] + public int MaxProcessingInstructionCount { get; set; } = StaticMaxProcessingInstructionCount; /// /// Gets or sets a value for the time to keep instructions in the database; records older than this number will be pruned. /// - public TimeSpan TimeToRetainInstructions { get; set; } = TimeSpan.FromDays(2); + [DefaultValue(StaticTimeToRetainInstructions)] + public TimeSpan TimeToRetainInstructions { get; set; } = TimeSpan.Parse(StaticTimeToRetainInstructions); /// /// Gets or sets a value for the time to wait between each sync operations. /// - public TimeSpan TimeBetweenSyncOperations { get; set; } = TimeSpan.FromSeconds(5); + [DefaultValue(StaticTimeBetweenSyncOperations)] + public TimeSpan TimeBetweenSyncOperations { get; set; } = TimeSpan.Parse(StaticTimeBetweenSyncOperations); /// /// Gets or sets a value for the time to wait between each prune operations. /// - public TimeSpan TimeBetweenPruneOperations { get; set; } = TimeSpan.FromMinutes(1); + [DefaultValue(StaticTimeBetweenPruneOperations)] + public TimeSpan TimeBetweenPruneOperations { get; set; } = TimeSpan.Parse(StaticTimeBetweenPruneOperations); } } diff --git a/src/Umbraco.Core/Configuration/Models/DatabaseServerRegistrarSettings.cs b/src/Umbraco.Core/Configuration/Models/DatabaseServerRegistrarSettings.cs index 66d35f6a36..91d293f272 100644 --- a/src/Umbraco.Core/Configuration/Models/DatabaseServerRegistrarSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/DatabaseServerRegistrarSettings.cs @@ -2,6 +2,7 @@ // See LICENSE for more details. using System; +using System.ComponentModel; namespace Umbraco.Cms.Core.Configuration.Models { @@ -10,14 +11,19 @@ namespace Umbraco.Cms.Core.Configuration.Models /// public class DatabaseServerRegistrarSettings { + internal const string StaticWaitTimeBetweenCalls = "00:01:00"; + internal const string StaticStaleServerTimeout = "00:02:00"; + /// /// Gets or sets a value for the amount of time to wait between calls to the database on the background thread. /// - public TimeSpan WaitTimeBetweenCalls { get; set; } = TimeSpan.FromMinutes(1); + [DefaultValue(StaticWaitTimeBetweenCalls)] + public TimeSpan WaitTimeBetweenCalls { get; set; } = TimeSpan.Parse(StaticWaitTimeBetweenCalls); /// /// Gets or sets a value for the time span to wait before considering a server stale, after it has last been accessed. /// - public TimeSpan StaleServerTimeout { get; set; } = TimeSpan.FromMinutes(2); + [DefaultValue(StaticStaleServerTimeout)] + public TimeSpan StaleServerTimeout { get; set; } = TimeSpan.Parse(StaticStaleServerTimeout); } } diff --git a/src/Umbraco.Core/Configuration/Models/ExceptionFilterSettings.cs b/src/Umbraco.Core/Configuration/Models/ExceptionFilterSettings.cs index 0a58036104..0d48453071 100644 --- a/src/Umbraco.Core/Configuration/Models/ExceptionFilterSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/ExceptionFilterSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) Umbraco. // See LICENSE for more details. +using System.ComponentModel; + namespace Umbraco.Cms.Core.Configuration.Models { /// @@ -9,9 +11,12 @@ namespace Umbraco.Cms.Core.Configuration.Models [UmbracoOptions(Constants.Configuration.ConfigExceptionFilter)] public class ExceptionFilterSettings { + internal const bool StaticDisabled = false; + /// /// Gets or sets a value indicating whether the exception filter is disabled. /// - public bool Disabled { get; set; } = false; + [DefaultValue(StaticDisabled)] + public bool Disabled { get; set; } = StaticDisabled; } } diff --git a/src/Umbraco.Core/Configuration/Models/GlobalSettings.cs b/src/Umbraco.Core/Configuration/Models/GlobalSettings.cs index 5c6e53df92..7799fec5ea 100644 --- a/src/Umbraco.Core/Configuration/Models/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/GlobalSettings.cs @@ -2,6 +2,7 @@ // See LICENSE for more details. using System; +using System.ComponentModel; namespace Umbraco.Cms.Core.Configuration.Models { @@ -11,51 +12,72 @@ namespace Umbraco.Cms.Core.Configuration.Models [UmbracoOptions(Constants.Configuration.ConfigGlobal)] public class GlobalSettings { - internal const string - StaticReservedPaths = "~/app_plugins/,~/install/,~/mini-profiler-resources/,~/umbraco/,"; // must end with a comma! - - internal const string - StaticReservedUrls = "~/.well-known,"; // must end with a comma! + internal const string StaticReservedPaths = "~/app_plugins/,~/install/,~/mini-profiler-resources/,~/umbraco/,"; // must end with a comma! + internal const string StaticReservedUrls = "~/.well-known,"; // must end with a comma! + internal const string StaticTimeOut = "00:20:00"; + internal const string StaticDefaultUILanguage = "en-US"; + internal const bool StaticHideTopLevelNodeFromPath = true; + internal const bool StaticUseHttps = false; + internal const int StaticVersionCheckPeriod = 7; + internal const string StaticUmbracoPath = "~/umbraco"; + internal const string StaticIconsPath = "~/umbraco/assets/icons"; + internal const string StaticUmbracoCssPath = "~/css"; + internal const string StaticUmbracoScriptsPath = "~/scripts"; + internal const string StaticUmbracoMediaPath = "~/media"; + internal const bool StaticInstallMissingDatabase = false; + internal const bool StaticDisableElectionForSingleServer = false; + internal const string StaticNoNodesViewPath = "~/umbraco/UmbracoWebsite/NoNodes.cshtml"; + internal const string StaticSqlWriteLockTimeOut = "00:00:05"; /// /// Gets or sets a value for the reserved URLs. + /// It must end with a comma /// + [DefaultValue(StaticReservedUrls)] public string ReservedUrls { get; set; } = StaticReservedUrls; /// /// Gets or sets a value for the reserved paths. + /// It must end with a comma /// + [DefaultValue(StaticReservedPaths)] public string ReservedPaths { get; set; } = StaticReservedPaths; /// /// Gets or sets a value for the timeout /// - public TimeSpan TimeOut{ get; set; } = TimeSpan.FromMinutes(20); + [DefaultValue(StaticTimeOut)] + public TimeSpan TimeOut { get; set; } = TimeSpan.Parse(StaticTimeOut); /// /// Gets or sets a value for the default UI language. /// - public string DefaultUILanguage { get; set; } = "en-US"; + [DefaultValue(StaticDefaultUILanguage)] + public string DefaultUILanguage { get; set; } = StaticDefaultUILanguage; /// /// Gets or sets a value indicating whether to hide the top level node from the path. /// - public bool HideTopLevelNodeFromPath { get; set; } = true; + [DefaultValue(StaticHideTopLevelNodeFromPath)] + public bool HideTopLevelNodeFromPath { get; set; } = StaticHideTopLevelNodeFromPath; /// /// Gets or sets a value indicating whether HTTPS should be used. /// - public bool UseHttps { get; set; } = false; + [DefaultValue(StaticUseHttps)] + public bool UseHttps { get; set; } = StaticUseHttps; /// /// Gets or sets a value for the version check period in days. /// - public int VersionCheckPeriod { get; set; } = 7; + [DefaultValue(StaticVersionCheckPeriod)] + public int VersionCheckPeriod { get; set; } = StaticVersionCheckPeriod; /// /// Gets or sets a value for the Umbraco back-office path. /// - public string UmbracoPath { get; set; } = "~/umbraco"; + [DefaultValue(StaticUmbracoPath)] + public string UmbracoPath { get; set; } = StaticUmbracoPath; /// /// Gets or sets a value for the Umbraco icons path. @@ -65,32 +87,38 @@ namespace Umbraco.Cms.Core.Configuration.Models /// so this should not be a normal get set it has to have dynamic ability to return the correct /// path given UmbracoPath if this hasn't been explicitly set. /// - public string IconsPath { get; set; } = $"~/umbraco/assets/icons"; + [DefaultValue(StaticIconsPath)] + public string IconsPath { get; set; } = StaticIconsPath; /// /// Gets or sets a value for the Umbraco CSS path. /// - public string UmbracoCssPath { get; set; } = "~/css"; + [DefaultValue(StaticUmbracoCssPath)] + public string UmbracoCssPath { get; set; } = StaticUmbracoCssPath; /// /// Gets or sets a value for the Umbraco scripts path. /// - public string UmbracoScriptsPath { get; set; } = "~/scripts"; + [DefaultValue(StaticUmbracoScriptsPath)] + public string UmbracoScriptsPath { get; set; } = StaticUmbracoScriptsPath; /// /// Gets or sets a value for the Umbraco media path. /// - public string UmbracoMediaPath { get; set; } = "~/media"; + [DefaultValue(StaticUmbracoMediaPath)] + public string UmbracoMediaPath { get; set; } = StaticUmbracoMediaPath; /// /// Gets or sets a value indicating whether to install the database when it is missing. /// - public bool InstallMissingDatabase { get; set; } = false; + [DefaultValue(StaticInstallMissingDatabase)] + public bool InstallMissingDatabase { get; set; } = StaticInstallMissingDatabase; /// /// Gets or sets a value indicating whether to disable the election for a single server. /// - public bool DisableElectionForSingleServer { get; set; } = false; + [DefaultValue(StaticDisableElectionForSingleServer)] + public bool DisableElectionForSingleServer { get; set; } = StaticDisableElectionForSingleServer; /// /// Gets or sets a value for the database factory server version. @@ -106,7 +134,8 @@ namespace Umbraco.Cms.Core.Configuration.Models /// /// Gets or sets a value for the path to the no content view. /// - public string NoNodesViewPath { get; set; } = "~/umbraco/UmbracoWebsite/NoNodes.cshtml"; + [DefaultValue(StaticNoNodesViewPath)] + public string NoNodesViewPath { get; set; } = StaticNoNodesViewPath; /// /// Gets or sets a value for the database server registrar settings. @@ -135,6 +164,7 @@ namespace Umbraco.Cms.Core.Configuration.Models /// The default value is 5000 milliseconds /// /// The timeout in milliseconds. - public TimeSpan SqlWriteLockTimeOut { get; } = TimeSpan.FromMilliseconds(5000); + [DefaultValue(StaticSqlWriteLockTimeOut)] + public TimeSpan SqlWriteLockTimeOut { get; } = TimeSpan.Parse(StaticSqlWriteLockTimeOut); } } diff --git a/src/Umbraco.Core/Configuration/Models/HealthChecksNotificationMethodSettings.cs b/src/Umbraco.Core/Configuration/Models/HealthChecksNotificationMethodSettings.cs index 0ca03d6cc0..2fc621a482 100644 --- a/src/Umbraco.Core/Configuration/Models/HealthChecksNotificationMethodSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/HealthChecksNotificationMethodSettings.cs @@ -2,6 +2,7 @@ // See LICENSE for more details. using System.Collections.Generic; +using System.ComponentModel; using Umbraco.Cms.Core.HealthChecks; namespace Umbraco.Cms.Core.Configuration.Models @@ -11,20 +12,27 @@ namespace Umbraco.Cms.Core.Configuration.Models /// public class HealthChecksNotificationMethodSettings { + internal const bool StaticEnabled = false; + internal const string StaticVerbosity = "Summary"; // Enum + internal const bool StaticFailureOnly = false; + /// /// Gets or sets a value indicating whether the health check notification method is enabled. /// - public bool Enabled { get; set; } = false; + [DefaultValue(StaticEnabled)] + public bool Enabled { get; set; } = StaticEnabled; /// /// Gets or sets a value for the health check notifications reporting verbosity. /// - public HealthCheckNotificationVerbosity Verbosity { get; set; } = HealthCheckNotificationVerbosity.Summary; + [DefaultValue(StaticVerbosity)] + public HealthCheckNotificationVerbosity Verbosity { get; set; } = Enum.Parse(StaticVerbosity); /// /// Gets or sets a value indicating whether the health check notifications should occur on failures only. /// - public bool FailureOnly { get; set; } = false; + [DefaultValue(StaticFailureOnly)] + public bool FailureOnly { get; set; } = StaticFailureOnly; /// /// Gets or sets a value providing provider specific settings for the health check notification method. diff --git a/src/Umbraco.Core/Configuration/Models/HealthChecksNotificationSettings.cs b/src/Umbraco.Core/Configuration/Models/HealthChecksNotificationSettings.cs index 316b494a19..6e082da19f 100644 --- a/src/Umbraco.Core/Configuration/Models/HealthChecksNotificationSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/HealthChecksNotificationSettings.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; namespace Umbraco.Cms.Core.Configuration.Models @@ -12,10 +13,14 @@ namespace Umbraco.Cms.Core.Configuration.Models /// public class HealthChecksNotificationSettings { + internal const bool StaticEnabled = false; + internal const string StaticPeriod = "1.00:00:00"; //TimeSpan.FromHours(24); + /// /// Gets or sets a value indicating whether health check notifications are enabled. /// - public bool Enabled { get; set; } = false; + [DefaultValue(StaticEnabled)] + public bool Enabled { get; set; } = StaticEnabled; /// /// Gets or sets a value for the first run time of a healthcheck notification in crontab format. @@ -25,7 +30,8 @@ namespace Umbraco.Cms.Core.Configuration.Models /// /// Gets or sets a value for the period of the healthcheck notification. /// - public TimeSpan Period { get; set; } = TimeSpan.FromHours(24); + [DefaultValue(StaticPeriod)] + public TimeSpan Period { get; set; } = TimeSpan.Parse(StaticPeriod); /// /// Gets or sets a value for the collection of health check notification methods. diff --git a/src/Umbraco.Core/Configuration/Models/HostingSettings.cs b/src/Umbraco.Core/Configuration/Models/HostingSettings.cs index 0017611fc0..b9e11e99ca 100644 --- a/src/Umbraco.Core/Configuration/Models/HostingSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/HostingSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) Umbraco. // See LICENSE for more details. +using System.ComponentModel; + namespace Umbraco.Cms.Core.Configuration.Models { /// @@ -9,6 +11,9 @@ namespace Umbraco.Cms.Core.Configuration.Models [UmbracoOptions(Constants.Configuration.ConfigHosting)] public class HostingSettings { + internal const string StaticLocalTempStorageLocation = "Default"; + internal const bool StaticDebug = false; + /// /// Gets or sets a value for the application virtual path. /// @@ -17,12 +22,14 @@ namespace Umbraco.Cms.Core.Configuration.Models /// /// Gets or sets a value for the location of temporary files. /// - public LocalTempStorage LocalTempStorageLocation { get; set; } = LocalTempStorage.Default; + [DefaultValue(StaticLocalTempStorageLocation)] + public LocalTempStorage LocalTempStorageLocation { get; set; } = Enum.Parse(StaticLocalTempStorageLocation); /// /// Gets or sets a value indicating whether umbraco is running in [debug mode]. /// /// true if [debug mode]; otherwise, false. - public bool Debug { get; set; } = false; + [DefaultValue(StaticDebug)] + public bool Debug { get; set; } = StaticDebug; } } diff --git a/src/Umbraco.Core/Configuration/Models/ImagingCacheSettings.cs b/src/Umbraco.Core/Configuration/Models/ImagingCacheSettings.cs index e9bdd77545..18fc5ccd93 100644 --- a/src/Umbraco.Core/Configuration/Models/ImagingCacheSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/ImagingCacheSettings.cs @@ -2,6 +2,7 @@ // See LICENSE for more details. using System; +using System.ComponentModel; using System.IO; namespace Umbraco.Cms.Core.Configuration.Models @@ -11,24 +12,33 @@ namespace Umbraco.Cms.Core.Configuration.Models /// public class ImagingCacheSettings { + internal const string StaticBrowserMaxAge = "7.00:00:00"; // TimeSpan.FromDays(7); + internal const string StaticCacheMaxAge = "365.00:00:00"; // TimeSpan.FromDays(365); + internal const int StaticCachedNameLength = 8; + internal const string StaticCacheFolder = "../umbraco/mediacache"; + /// /// Gets or sets a value for the browser image cache maximum age. /// - public TimeSpan BrowserMaxAge { get; set; } = TimeSpan.FromDays(7); + [DefaultValue(StaticBrowserMaxAge)] + public TimeSpan BrowserMaxAge { get; set; } = TimeSpan.Parse(StaticBrowserMaxAge); /// /// Gets or sets a value for the image cache maximum age. /// - public TimeSpan CacheMaxAge { get; set; } = TimeSpan.FromDays(365); + [DefaultValue(StaticCacheMaxAge)] + public TimeSpan CacheMaxAge { get; set; } = TimeSpan.Parse(StaticCacheMaxAge); /// /// Gets or sets a value for length of the cached name. /// - public uint CachedNameLength { get; set; } = 8; + [DefaultValue(StaticCachedNameLength)] + public uint CachedNameLength { get; set; } = StaticCachedNameLength; /// /// Gets or sets a value for the cache folder. /// - public string CacheFolder { get; set; } = Path.Combine("..", "umbraco", "mediacache"); + [DefaultValue(StaticCacheFolder)] + public string CacheFolder { get; set; } = StaticCacheFolder; } } diff --git a/src/Umbraco.Core/Configuration/Models/ImagingResizeSettings.cs b/src/Umbraco.Core/Configuration/Models/ImagingResizeSettings.cs index e71ed4f2e4..ff02fdc522 100644 --- a/src/Umbraco.Core/Configuration/Models/ImagingResizeSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/ImagingResizeSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) Umbraco. // See LICENSE for more details. +using System.ComponentModel; + namespace Umbraco.Cms.Core.Configuration.Models { /// @@ -8,14 +10,19 @@ namespace Umbraco.Cms.Core.Configuration.Models /// public class ImagingResizeSettings { + internal const int StaticMaxWidth = 5000; + internal const int StaticMaxHeight = 5000; + /// /// Gets or sets a value for the maximim resize width. /// - public int MaxWidth { get; set; } = 5000; + [DefaultValue(StaticMaxWidth)] + public int MaxWidth { get; set; } = StaticMaxWidth; /// /// Gets or sets a value for the maximim resize height. /// - public int MaxHeight { get; set; } = 5000; + [DefaultValue(StaticMaxHeight)] + public int MaxHeight { get; set; } = StaticMaxHeight; } } diff --git a/src/Umbraco.Core/Configuration/Models/KeepAliveSettings.cs b/src/Umbraco.Core/Configuration/Models/KeepAliveSettings.cs index 14c2a29f93..305df2be8c 100644 --- a/src/Umbraco.Core/Configuration/Models/KeepAliveSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/KeepAliveSettings.cs @@ -1,8 +1,7 @@ // Copyright (c) Umbraco. // See LICENSE for more details. -using System; -using Umbraco.Cms.Core.Hosting; +using System.ComponentModel; namespace Umbraco.Cms.Core.Configuration.Models { @@ -12,10 +11,13 @@ namespace Umbraco.Cms.Core.Configuration.Models [UmbracoOptions(Constants.Configuration.ConfigKeepAlive)] public class KeepAliveSettings { + internal const bool StaticDisableKeepAliveTask = false; + /// /// Gets or sets a value indicating whether the keep alive task is disabled. /// - public bool DisableKeepAliveTask { get; set; } = false; + [DefaultValue(StaticDisableKeepAliveTask)] + public bool DisableKeepAliveTask { get; set; } = StaticDisableKeepAliveTask; /// /// Gets a value for the keep alive ping URL. diff --git a/src/Umbraco.Core/Configuration/Models/LoggingSettings.cs b/src/Umbraco.Core/Configuration/Models/LoggingSettings.cs index b9d6fd2897..2075921c3f 100644 --- a/src/Umbraco.Core/Configuration/Models/LoggingSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/LoggingSettings.cs @@ -2,6 +2,7 @@ // See LICENSE for more details. using System; +using System.ComponentModel; namespace Umbraco.Cms.Core.Configuration.Models { @@ -11,9 +12,12 @@ namespace Umbraco.Cms.Core.Configuration.Models [UmbracoOptions(Constants.Configuration.ConfigLogging)] public class LoggingSettings { + internal const string StaticMaxLogAge = "1.00:00:00"; // TimeSpan.FromHours(24); + /// /// Gets or sets a value for the maximum age of a log file. /// - public TimeSpan MaxLogAge { get; set; } = TimeSpan.FromHours(24); + [DefaultValue(StaticMaxLogAge)] + public TimeSpan MaxLogAge { get; set; } = TimeSpan.Parse(StaticMaxLogAge); } } diff --git a/src/Umbraco.Core/Configuration/Models/MemberPasswordConfigurationSettings.cs b/src/Umbraco.Core/Configuration/Models/MemberPasswordConfigurationSettings.cs index 84bfeb3d3d..fa4f0725f7 100644 --- a/src/Umbraco.Core/Configuration/Models/MemberPasswordConfigurationSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/MemberPasswordConfigurationSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) Umbraco. // See LICENSE for more details. +using System.ComponentModel; + namespace Umbraco.Cms.Core.Configuration.Models { /// @@ -9,25 +11,39 @@ namespace Umbraco.Cms.Core.Configuration.Models [UmbracoOptions(Constants.Configuration.ConfigMemberPassword)] public class MemberPasswordConfigurationSettings : IPasswordConfiguration { - /// - public int RequiredLength { get; set; } = 10; + internal const int StaticRequiredLength = 10; + internal const bool StaticRequireNonLetterOrDigit = false; + internal const bool StaticRequireDigit = false; + internal const bool StaticRequireLowercase = false; + internal const bool StaticRequireUppercase = false; + internal const int StaticMaxFailedAccessAttemptsBeforeLockout = 5; /// - public bool RequireNonLetterOrDigit { get; set; } = false; + [DefaultValue(StaticRequiredLength)] + public int RequiredLength { get; set; } = StaticRequiredLength; /// - public bool RequireDigit { get; set; } = false; + [DefaultValue(StaticRequireNonLetterOrDigit)] + public bool RequireNonLetterOrDigit { get; set; } = StaticRequireNonLetterOrDigit; /// - public bool RequireLowercase { get; set; } = false; + [DefaultValue(StaticRequireDigit)] + public bool RequireDigit { get; set; } = StaticRequireDigit; /// - public bool RequireUppercase { get; set; } = false; + [DefaultValue(StaticRequireLowercase)] + public bool RequireLowercase { get; set; } = StaticRequireLowercase; /// + [DefaultValue(StaticRequireUppercase)] + public bool RequireUppercase { get; set; } = StaticRequireUppercase; + + /// + [DefaultValue(Constants.Security.AspNetCoreV3PasswordHashAlgorithmName)] public string HashAlgorithmType { get; set; } = Constants.Security.AspNetCoreV3PasswordHashAlgorithmName; /// - public int MaxFailedAccessAttemptsBeforeLockout { get; set; } = 5; + [DefaultValue(StaticMaxFailedAccessAttemptsBeforeLockout)] + public int MaxFailedAccessAttemptsBeforeLockout { get; set; } = StaticMaxFailedAccessAttemptsBeforeLockout; } } diff --git a/src/Umbraco.Core/Configuration/Models/ModelsBuilderSettings.cs b/src/Umbraco.Core/Configuration/Models/ModelsBuilderSettings.cs index ea2fa0623e..2cf1f770b7 100644 --- a/src/Umbraco.Core/Configuration/Models/ModelsBuilderSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/ModelsBuilderSettings.cs @@ -1,6 +1,7 @@ // Copyright (c) Umbraco. // See LICENSE for more details. +using System.ComponentModel; using Umbraco.Cms.Core.Configuration.Models; using Umbraco.Extensions; @@ -13,18 +14,22 @@ namespace Umbraco.Cms.Core.Configuration.Models public class ModelsBuilderSettings { private bool _flagOutOfDateModels = true; - - private static string DefaultModelsDirectory => "~/umbraco/models"; + internal const string StaticModelsMode = "InMemoryAuto"; + internal const string StaticModelsDirectory = "~/umbraco/models"; + internal const bool StaticAcceptUnsafeModelsDirectory = false; + internal const int StaticDebugLevel = 0; /// /// Gets or sets a value for the models mode. /// - public ModelsMode ModelsMode { get; set; } = ModelsMode.InMemoryAuto; + [DefaultValue(StaticModelsMode)] + public ModelsMode ModelsMode { get; set; } = Enum.Parse(StaticModelsMode); /// /// Gets or sets a value for models namespace. /// /// That value could be overriden by other (attribute in user's code...). Return default if no value was supplied. + [DefaultValue(Constants.ModelsBuilder.DefaultModelsNamespace)] public string ModelsNamespace { get; set; } = Constants.ModelsBuilder.DefaultModelsNamespace; /// @@ -54,7 +59,8 @@ namespace Umbraco.Cms.Core.Configuration.Models /// Gets or sets a value for the models directory. /// /// Default is ~/umbraco/models but that can be changed. - public string ModelsDirectory { get; set; } = DefaultModelsDirectory; + [DefaultValue(StaticModelsDirectory)] + public string ModelsDirectory { get; set; } = StaticModelsDirectory; /// @@ -64,12 +70,14 @@ namespace Umbraco.Cms.Core.Configuration.Models /// An unsafe value is an absolute path, or a relative path pointing outside /// of the website root. /// - public bool AcceptUnsafeModelsDirectory { get; set; } = false; + [DefaultValue(StaticAcceptUnsafeModelsDirectory)] + public bool AcceptUnsafeModelsDirectory { get; set; } = StaticAcceptUnsafeModelsDirectory; /// /// Gets or sets a value indicating the debug log level. /// /// 0 means minimal (safe on live site), anything else means more and more details (maybe not safe). - public int DebugLevel { get; set; } = 0; + [DefaultValue(StaticDebugLevel)] + public int DebugLevel { get; set; } = StaticDebugLevel; } } diff --git a/src/Umbraco.Core/Configuration/Models/NuCacheSettings.cs b/src/Umbraco.Core/Configuration/Models/NuCacheSettings.cs index b71c374c3f..bd92b4ba3c 100644 --- a/src/Umbraco.Core/Configuration/Models/NuCacheSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/NuCacheSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) Umbraco. // See LICENSE for more details. +using System.ComponentModel; + namespace Umbraco.Cms.Core.Configuration.Models { /// @@ -9,6 +11,9 @@ namespace Umbraco.Cms.Core.Configuration.Models [UmbracoOptions(Constants.Configuration.ConfigNuCache)] public class NuCacheSettings { + internal const string StaticNuCacheSerializerType = "MessagePack"; + internal const int StaticSqlPageSize = 1000; + /// /// Gets or sets a value defining the BTree block size. /// @@ -17,11 +22,13 @@ namespace Umbraco.Cms.Core.Configuration.Models /// /// The serializer type that nucache uses to persist documents in the database. /// - public NuCacheSerializerType NuCacheSerializerType { get; set; } = NuCacheSerializerType.MessagePack; + [DefaultValue(StaticNuCacheSerializerType)] + public NuCacheSerializerType NuCacheSerializerType { get; set; } = Enum.Parse(StaticNuCacheSerializerType); /// /// The paging size to use for nucache SQL queries. /// - public int SqlPageSize { get; set; } = 1000; + [DefaultValue(StaticSqlPageSize)] + public int SqlPageSize { get; set; } = StaticSqlPageSize; } } diff --git a/src/Umbraco.Core/Configuration/Models/RequestHandlerSettings.cs b/src/Umbraco.Core/Configuration/Models/RequestHandlerSettings.cs index 6f6a9c6236..ee223b36c6 100644 --- a/src/Umbraco.Core/Configuration/Models/RequestHandlerSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/RequestHandlerSettings.cs @@ -2,6 +2,7 @@ // See LICENSE for more details. using System.Collections.Generic; +using System.ComponentModel; using Umbraco.Cms.Core.Configuration.UmbracoSettings; using Umbraco.Extensions; @@ -13,6 +14,9 @@ namespace Umbraco.Cms.Core.Configuration.Models [UmbracoOptions(Constants.Configuration.ConfigRequestHandler)] public class RequestHandlerSettings { + internal const bool StaticAddTrailingSlash = true; + internal const string StaticConvertUrlsToAscii = "try"; + internal static readonly CharItem[] DefaultCharCollection = { new CharItem { Char = " ", Replacement = "-" }, @@ -44,12 +48,14 @@ namespace Umbraco.Cms.Core.Configuration.Models /// /// Gets or sets a value indicating whether to add a trailing slash to URLs. /// - public bool AddTrailingSlash { get; set; } = true; + [DefaultValue(StaticAddTrailingSlash)] + public bool AddTrailingSlash { get; set; } = StaticAddTrailingSlash; /// /// Gets or sets a value indicating whether to convert URLs to ASCII (valid values: "true", "try" or "false"). /// - public string ConvertUrlsToAscii { get; set; } = "try"; + [DefaultValue(StaticConvertUrlsToAscii)] + public string ConvertUrlsToAscii { get; set; } = StaticConvertUrlsToAscii; /// /// Gets a value indicating whether URLs should be converted to ASCII. @@ -83,6 +89,7 @@ namespace Umbraco.Cms.Core.Configuration.Models /// /// Gets or sets a value for the default character collection for replacements. /// + /// WB-TODO public IEnumerable CharCollection { get; set; } = DefaultCharCollection; /// diff --git a/src/Umbraco.Core/Configuration/Models/RichTextEditorSettings.cs b/src/Umbraco.Core/Configuration/Models/RichTextEditorSettings.cs index a5d1ae7475..6ea563c741 100644 --- a/src/Umbraco.Core/Configuration/Models/RichTextEditorSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/RichTextEditorSettings.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System.Collections.Generic; +using System.ComponentModel; using Umbraco.Cms.Core.Models.ContentEditing; namespace Umbraco.Cms.Core.Configuration.Models @@ -6,6 +7,9 @@ namespace Umbraco.Cms.Core.Configuration.Models [UmbracoOptions(Constants.Configuration.ConfigRichTextEditor)] public class RichTextEditorSettings { + internal const string StaticValidElements = "+a[id|style|rel|data-id|data-udi|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|reversed|start|style|type],-ul[class|style],-li[class|style],br[class],img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align|umbracoorgwidth|umbracoorgheight|onresize|onresizestart|onresizeend|rel|data-id],-sub[style|class],-sup[style|class],-blockquote[dir|style|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[class|align|style],-pre[class|align|style],address[class|align|style],-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],-h3[id|dir|class|align|style],-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|style|dir|class|align|style],hr[class|style],small[class|style],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],object[class|id|width|height|codebase|*],param[name|value|_value|class],embed[type|width|height|src|class|*],map[name|class],area[shape|coords|href|alt|target|class],bdo[class],button[class],iframe[*]"; + internal const string StaticInvalidElements = "font"; + private static readonly string[] s_default_plugins = new[] { "paste", @@ -62,11 +66,34 @@ namespace Umbraco.Cms.Core.Configuration.Models ["entity_encoding"] = "raw" }; + /// + /// HTML RichText Editor TinyMCE Commands + /// + /// WB-TODO Custom Array of objects public RichTextEditorCommand[] Commands { get; set; } = s_default_commands; + + /// + /// HTML RichText Editor TinyMCE Plugins + /// public string[] Plugins { get; set; } = s_default_plugins; + + /// + /// HTML RichText Editor TinyMCE Custom Config + /// + /// WB-TODO Custom Dictionary public IDictionary CustomConfig { get; set; } = s_default_custom_config; - public string ValidElements { get; set; } = "+a[id|style|rel|data-id|data-udi|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|reversed|start|style|type],-ul[class|style],-li[class|style],br[class],img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align|umbracoorgwidth|umbracoorgheight|onresize|onresizestart|onresizeend|rel|data-id],-sub[style|class],-sup[style|class],-blockquote[dir|style|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[class|align|style],-pre[class|align|style],address[class|align|style],-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],-h3[id|dir|class|align|style],-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|style|dir|class|align|style],hr[class|style],small[class|style],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],object[class|id|width|height|codebase|*],param[name|value|_value|class],embed[type|width|height|src|class|*],map[name|class],area[shape|coords|href|alt|target|class],bdo[class],button[class],iframe[*]"; - public string InvalidElements { get; set; } = "font"; + + /// + /// + /// + [DefaultValue(StaticValidElements)] + public string ValidElements { get; set; } = StaticValidElements; + + /// + /// Invalid HTML elements for RichText Editor + /// + [DefaultValue(StaticInvalidElements)] + public string InvalidElements { get; set; } = StaticInvalidElements; public class RichTextEditorCommand { diff --git a/src/Umbraco.Core/Configuration/Models/RuntimeMinificationSettings.cs b/src/Umbraco.Core/Configuration/Models/RuntimeMinificationSettings.cs index f0fd4e71e1..b03528fd0a 100644 --- a/src/Umbraco.Core/Configuration/Models/RuntimeMinificationSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/RuntimeMinificationSettings.cs @@ -1,17 +1,23 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.ComponentModel; namespace Umbraco.Cms.Core.Configuration.Models { [UmbracoOptions(Constants.Configuration.ConfigRuntimeMinification)] public class RuntimeMinificationSettings { - public bool UseInMemoryCache { get; set; } = false; + internal const bool StaticUseInMemoryCache = false; + internal const string StaticCacheBuster = "Version"; + + /// + /// Use in memory cache + /// + [DefaultValue(StaticUseInMemoryCache)] + public bool UseInMemoryCache { get; set; } = StaticUseInMemoryCache; /// /// The cache buster type to use /// - public RuntimeMinificationCacheBuster CacheBuster { get; set; } = RuntimeMinificationCacheBuster.Version; + [DefaultValue(StaticCacheBuster)] + public RuntimeMinificationCacheBuster CacheBuster { get; set; } = Enum.Parse(StaticCacheBuster); } } diff --git a/src/Umbraco.Core/Configuration/Models/SecuritySettings.cs b/src/Umbraco.Core/Configuration/Models/SecuritySettings.cs index 392e5f2118..48e08d596a 100644 --- a/src/Umbraco.Core/Configuration/Models/SecuritySettings.cs +++ b/src/Umbraco.Core/Configuration/Models/SecuritySettings.cs @@ -1,6 +1,8 @@ // Copyright (c) Umbraco. // See LICENSE for more details. +using System.ComponentModel; + namespace Umbraco.Cms.Core.Configuration.Models { /// @@ -9,25 +11,34 @@ namespace Umbraco.Cms.Core.Configuration.Models [UmbracoOptions(Constants.Configuration.ConfigSecurity)] public class SecuritySettings { + internal const bool StaticKeepUserLoggedIn = false; + internal const bool StaticHideDisabledUsersInBackOffice = false; + internal const bool StaticAllowPasswordReset = true; + internal const string StaticAuthCookieName = "UMB_UCONTEXT"; + /// /// Gets or sets a value indicating whether to keep the user logged in. /// - public bool KeepUserLoggedIn { get; set; } = false; + [DefaultValue(StaticKeepUserLoggedIn)] + public bool KeepUserLoggedIn { get; set; } = StaticKeepUserLoggedIn; /// /// Gets or sets a value indicating whether to hide disabled users in the back-office. /// - public bool HideDisabledUsersInBackOffice { get; set; } = false; + [DefaultValue(StaticHideDisabledUsersInBackOffice)] + public bool HideDisabledUsersInBackOffice { get; set; } = StaticHideDisabledUsersInBackOffice; /// /// Gets or sets a value indicating whether to allow user password reset. /// - public bool AllowPasswordReset { get; set; } = true; + [DefaultValue(StaticAllowPasswordReset)] + public bool AllowPasswordReset { get; set; } = StaticAllowPasswordReset; /// /// Gets or sets a value for the authorization cookie name. /// - public string AuthCookieName { get; set; } = "UMB_UCONTEXT"; + [DefaultValue(StaticAuthCookieName)] + public string AuthCookieName { get; set; } = StaticAuthCookieName; /// /// Gets or sets a value for the authorization cookie domain. diff --git a/src/Umbraco.Core/Configuration/Models/SmtpSettings.cs b/src/Umbraco.Core/Configuration/Models/SmtpSettings.cs index 22a3c1ea2f..dca2b70558 100644 --- a/src/Umbraco.Core/Configuration/Models/SmtpSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/SmtpSettings.cs @@ -1,6 +1,7 @@ // Copyright (c) Umbraco. // See LICENSE for more details. +using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Net.Mail; using Umbraco.Cms.Core.Configuration.Models.Validation; @@ -45,6 +46,9 @@ namespace Umbraco.Cms.Core.Configuration.Models /// public class SmtpSettings : ValidatableEntryBase { + internal const string StaticSecureSocketOptions = "Auto"; + internal const string StaticDeliveryMethod = "Network"; + /// /// Gets or sets a value for the SMTP from address to use for messages. /// @@ -65,7 +69,8 @@ namespace Umbraco.Cms.Core.Configuration.Models /// /// Gets or sets a value for the secure socket options. /// - public SecureSocketOptions SecureSocketOptions { get; set; } = SecureSocketOptions.Auto; + [DefaultValue(StaticSecureSocketOptions)] + public SecureSocketOptions SecureSocketOptions { get; set; } = Enum.Parse(StaticSecureSocketOptions); /// /// Gets or sets a value for the SMTP pick-up directory. @@ -75,7 +80,8 @@ namespace Umbraco.Cms.Core.Configuration.Models /// /// Gets or sets a value for the SMTP delivery method. /// - public SmtpDeliveryMethod DeliveryMethod { get; set; } = SmtpDeliveryMethod.Network; + [DefaultValue(StaticDeliveryMethod)] + public SmtpDeliveryMethod DeliveryMethod { get; set; } = Enum.Parse(StaticDeliveryMethod); /// /// Gets or sets a value for the SMTP user name. diff --git a/src/Umbraco.Core/Configuration/Models/TourSettings.cs b/src/Umbraco.Core/Configuration/Models/TourSettings.cs index c73c4737b8..cdc54dfe1f 100644 --- a/src/Umbraco.Core/Configuration/Models/TourSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/TourSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) Umbraco. // See LICENSE for more details. +using System.ComponentModel; + namespace Umbraco.Cms.Core.Configuration.Models { /// @@ -9,9 +11,12 @@ namespace Umbraco.Cms.Core.Configuration.Models [UmbracoOptions(Constants.Configuration.ConfigTours)] public class TourSettings { + internal const bool StaticEnableTours = true; + /// /// Gets or sets a value indicating whether back-office tours are enabled. /// - public bool EnableTours { get; set; } = true; + [DefaultValue(StaticEnableTours)] + public bool EnableTours { get; set; } = StaticEnableTours; } } diff --git a/src/Umbraco.Core/Configuration/Models/UmbracoPluginSettings.cs b/src/Umbraco.Core/Configuration/Models/UmbracoPluginSettings.cs index 19bab8141d..d5b74b38dc 100644 --- a/src/Umbraco.Core/Configuration/Models/UmbracoPluginSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/UmbracoPluginSettings.cs @@ -1,4 +1,4 @@ -// Copyright (c) Umbraco. +// Copyright (c) Umbraco. // See LICENSE for more details. using System.Collections.Generic; @@ -11,9 +11,12 @@ namespace Umbraco.Cms.Core.Configuration.Models [UmbracoOptions(Constants.Configuration.ConfigPlugins)] public class UmbracoPluginSettings { + + /// /// Gets or sets the allowed file extensions (including the period ".") that should be accessible from the browser. /// + /// WB-TODO public ISet BrowsableFileExtensions { get; set; } = new HashSet(new[] { ".html", // markup diff --git a/src/Umbraco.Core/Configuration/Models/UnattendedSettings.cs b/src/Umbraco.Core/Configuration/Models/UnattendedSettings.cs index 00c0be4b3b..ba1c6827df 100644 --- a/src/Umbraco.Core/Configuration/Models/UnattendedSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/UnattendedSettings.cs @@ -1,4 +1,5 @@ -using System.ComponentModel.DataAnnotations; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; namespace Umbraco.Cms.Core.Configuration.Models { @@ -9,6 +10,9 @@ namespace Umbraco.Cms.Core.Configuration.Models [UmbracoOptions(Constants.Configuration.ConfigUnattended)] public class UnattendedSettings { + internal const bool StaticInstallUnattended = false; + internal const bool StaticUpgradeUnattended = false; + /// /// Gets or sets a value indicating whether unattended installs are enabled. /// @@ -18,12 +22,14 @@ namespace Umbraco.Cms.Core.Configuration.Models /// If this option is set to true an unattended install will be performed and the runtime enters /// the Run level. /// - public bool InstallUnattended { get; set; } = false; + [DefaultValue(StaticInstallUnattended)] + public bool InstallUnattended { get; set; } = StaticInstallUnattended; /// /// Gets or sets a value indicating whether unattended upgrades are enabled. /// - public bool UpgradeUnattended { get; set; } = false; + [DefaultValue(StaticUpgradeUnattended)] + public bool UpgradeUnattended { get; set; } = StaticUpgradeUnattended; /// diff --git a/src/Umbraco.Core/Configuration/Models/UserPasswordConfigurationSettings.cs b/src/Umbraco.Core/Configuration/Models/UserPasswordConfigurationSettings.cs index ccc9129a1c..b53e98f712 100644 --- a/src/Umbraco.Core/Configuration/Models/UserPasswordConfigurationSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/UserPasswordConfigurationSettings.cs @@ -1,6 +1,8 @@ // Copyright (c) Umbraco. // See LICENSE for more details. +using System.ComponentModel; + namespace Umbraco.Cms.Core.Configuration.Models { /// @@ -9,25 +11,39 @@ namespace Umbraco.Cms.Core.Configuration.Models [UmbracoOptions(Constants.Configuration.ConfigUserPassword)] public class UserPasswordConfigurationSettings : IPasswordConfiguration { - /// - public int RequiredLength { get; set; } = 10; + internal const int StaticRequiredLength = 10; + internal const bool StaticRequireNonLetterOrDigit = false; + internal const bool StaticRequireDigit = false; + internal const bool StaticRequireLowercase = false; + internal const bool StaticRequireUppercase = false; + internal const int StaticMaxFailedAccessAttemptsBeforeLockout = 5; /// - public bool RequireNonLetterOrDigit { get; set; } = false; + [DefaultValue(StaticRequiredLength)] + public int RequiredLength { get; set; } = StaticRequiredLength; /// - public bool RequireDigit { get; set; } = false; + [DefaultValue(StaticRequireNonLetterOrDigit)] + public bool RequireNonLetterOrDigit { get; set; } = StaticRequireNonLetterOrDigit; /// - public bool RequireLowercase { get; set; } = false; + [DefaultValue(StaticRequireDigit)] + public bool RequireDigit { get; set; } = StaticRequireDigit; /// - public bool RequireUppercase { get; set; } = false; + [DefaultValue(StaticRequireLowercase)] + public bool RequireLowercase { get; set; } = StaticRequireLowercase; /// + [DefaultValue(StaticRequireUppercase)] + public bool RequireUppercase { get; set; } = StaticRequireUppercase; + + /// + [DefaultValue(Constants.Security.AspNetCoreV3PasswordHashAlgorithmName)] public string HashAlgorithmType { get; set; } = Constants.Security.AspNetCoreV3PasswordHashAlgorithmName; /// - public int MaxFailedAccessAttemptsBeforeLockout { get; set; } = 5; + [DefaultValue(StaticMaxFailedAccessAttemptsBeforeLockout)] + public int MaxFailedAccessAttemptsBeforeLockout { get; set; } = StaticMaxFailedAccessAttemptsBeforeLockout; } } diff --git a/src/Umbraco.Core/Configuration/Models/WebRoutingSettings.cs b/src/Umbraco.Core/Configuration/Models/WebRoutingSettings.cs index 3c1c372c00..629095e32c 100644 --- a/src/Umbraco.Core/Configuration/Models/WebRoutingSettings.cs +++ b/src/Umbraco.Core/Configuration/Models/WebRoutingSettings.cs @@ -1,6 +1,7 @@ // Copyright (c) Umbraco. // See LICENSE for more details. +using System.ComponentModel; using Umbraco.Cms.Core.Models.PublishedContent; namespace Umbraco.Cms.Core.Configuration.Models @@ -11,6 +12,16 @@ namespace Umbraco.Cms.Core.Configuration.Models [UmbracoOptions(Constants.Configuration.ConfigWebRouting)] public class WebRoutingSettings { + + internal const bool StaticTryMatchingEndpointsForAllPages = false; + internal const bool StaticTrySkipIisCustomErrors = false; + internal const bool StaticInternalRedirectPreservesTemplate = false; + internal const bool StaticDisableAlternativeTemplates = false; + internal const bool StaticValidateAlternativeTemplates = false; + internal const bool StaticDisableFindContentByIdPath = false; + internal const bool StaticDisableRedirectUrlTracking = false; + internal const string StaticUrlProviderMode = "Auto"; + /// /// Gets or sets a value indicating whether to check if any routed endpoints match a front-end request before /// the Umbraco dynamic router tries to map the request to an Umbraco content item. @@ -20,42 +31,50 @@ namespace Umbraco.Cms.Core.Configuration.Models /// ASP.NET Core will automatically handle this in all cases. This is more of a backward compatible option since this is what v7/v8 used /// to do. /// - public bool TryMatchingEndpointsForAllPages { get; set; } = false; + [DefaultValue(StaticTryMatchingEndpointsForAllPages)] + public bool TryMatchingEndpointsForAllPages { get; set; } = StaticTryMatchingEndpointsForAllPages; /// /// Gets or sets a value indicating whether IIS custom errors should be skipped. /// - public bool TrySkipIisCustomErrors { get; set; } = false; + [DefaultValue(StaticTrySkipIisCustomErrors)] + public bool TrySkipIisCustomErrors { get; set; } = StaticTrySkipIisCustomErrors; /// /// Gets or sets a value indicating whether an internal redirect should preserve the template. /// - public bool InternalRedirectPreservesTemplate { get; set; } = false; + [DefaultValue(StaticInternalRedirectPreservesTemplate)] + public bool InternalRedirectPreservesTemplate { get; set; } = StaticInternalRedirectPreservesTemplate; /// /// Gets or sets a value indicating whether the use of alternative templates are disabled. /// - public bool DisableAlternativeTemplates { get; set; } = false; + [DefaultValue(StaticDisableAlternativeTemplates)] + public bool DisableAlternativeTemplates { get; set; } = StaticDisableAlternativeTemplates; /// /// Gets or sets a value indicating whether the use of alternative templates should be validated. /// - public bool ValidateAlternativeTemplates { get; set; } = false; + [DefaultValue(StaticValidateAlternativeTemplates)] + public bool ValidateAlternativeTemplates { get; set; } = StaticValidateAlternativeTemplates; /// /// Gets or sets a value indicating whether find content ID by path is disabled. /// - public bool DisableFindContentByIdPath { get; set; } = false; + [DefaultValue(StaticDisableFindContentByIdPath)] + public bool DisableFindContentByIdPath { get; set; } = StaticDisableFindContentByIdPath; /// /// Gets or sets a value indicating whether redirect URL tracking is disabled. /// - public bool DisableRedirectUrlTracking { get; set; } = false; + [DefaultValue(StaticDisableRedirectUrlTracking)] + public bool DisableRedirectUrlTracking { get; set; } = StaticDisableRedirectUrlTracking; /// /// Gets or sets a value for the URL provider mode (). /// - public UrlMode UrlProviderMode { get; set; } = UrlMode.Auto; + [DefaultValue(StaticUrlProviderMode)] + public UrlMode UrlProviderMode { get; set; } = Enum.Parse(StaticUrlProviderMode); /// /// Gets or sets a value for the Umbraco application URL.