// Copyright (c) Umbraco. // See LICENSE for more details. using System.ComponentModel; namespace Umbraco.Cms.Core.Configuration.Models; /// /// Typed configuration options for global settings. /// [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 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 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 StaticDistributedLockingReadLockDefaultTimeout = "00:01:00"; internal const string StaticDistributedLockingWriteLockDefaultTimeout = "00:00:05"; internal const bool StaticSanitizeTinyMce = false; internal const int StaticMainDomReleaseSignalPollingInterval = 2000; private const bool StaticForceCombineUrlPathLeftToRight = true; /// /// Gets or sets a value for the reserved URLs (must end with a comma). /// [DefaultValue(StaticReservedUrls)] public string ReservedUrls { get; set; } = StaticReservedUrls; /// /// Gets or sets a value for the reserved paths (must end with a comma). /// [DefaultValue(StaticReservedPaths)] public string ReservedPaths { get; set; } = StaticReservedPaths; /// /// Gets or sets a value for the back-office login timeout. /// [DefaultValue(StaticTimeOut)] public TimeSpan TimeOut { get; set; } = TimeSpan.Parse(StaticTimeOut); /// /// Gets or sets a value for the default UI language. /// [DefaultValue(StaticDefaultUILanguage)] public string DefaultUILanguage { get; set; } = StaticDefaultUILanguage; /// /// Gets or sets a value indicating whether to hide the top level node from the path. /// [DefaultValue(StaticHideTopLevelNodeFromPath)] public bool HideTopLevelNodeFromPath { get; set; } = StaticHideTopLevelNodeFromPath; /// /// Gets or sets a value indicating whether HTTPS should be used. /// [DefaultValue(StaticUseHttps)] public bool UseHttps { get; set; } = StaticUseHttps; /// /// Gets or sets a value for the version check period in days. /// [DefaultValue(StaticVersionCheckPeriod)] public int VersionCheckPeriod { get; set; } = StaticVersionCheckPeriod; /// /// Gets or sets a value for the Umbraco back-office path. /// public string UmbracoPath { get => Constants.System.DefaultUmbracoPath; [Obsolete($"{nameof(UmbracoPath)} is no longer configurable, property setter is scheduled for removal in V12")] // NOTE: when removing this, also clean up the hardcoded removal of UmbracoPath in UmbracoJsonSchemaGenerator set { } } /// /// Gets or sets a value for the Umbraco icons path. /// /// /// TODO: Umbraco cannot be hard coded here that is what UmbracoPath is for /// 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. /// [DefaultValue(StaticIconsPath)] public string IconsPath { get; set; } = StaticIconsPath; /// /// Gets or sets a value for the Umbraco CSS path. /// [DefaultValue(StaticUmbracoCssPath)] public string UmbracoCssPath { get; set; } = StaticUmbracoCssPath; /// /// Gets or sets a value for the Umbraco scripts path. /// [DefaultValue(StaticUmbracoScriptsPath)] public string UmbracoScriptsPath { get; set; } = StaticUmbracoScriptsPath; /// /// Gets or sets a value for the Umbraco media request path. /// [DefaultValue(StaticUmbracoMediaPath)] public string UmbracoMediaPath { get; set; } = StaticUmbracoMediaPath; /// /// Gets or sets a value for the physical Umbraco media root path (falls back to when /// empty). /// /// /// If the value is a virtual path, it's resolved relative to the webroot. /// public string UmbracoMediaPhysicalRootPath { get; set; } = null!; /// /// Gets or sets a value indicating whether to install the database when it is missing. /// [DefaultValue(StaticInstallMissingDatabase)] public bool InstallMissingDatabase { get; set; } = StaticInstallMissingDatabase; /// /// Gets or sets a value indicating whether to disable the election for a single server. /// [DefaultValue(StaticDisableElectionForSingleServer)] public bool DisableElectionForSingleServer { get; set; } = StaticDisableElectionForSingleServer; /// /// Gets or sets a value for the database factory server version. /// public string DatabaseFactoryServerVersion { get; set; } = string.Empty; /// /// Gets or sets a value for the main dom lock. /// public string MainDomLock { get; set; } = string.Empty; /// /// Gets or sets a value to discriminate MainDom boundaries. /// /// Generally the default should suffice but useful for advanced scenarios e.g. azure deployment slot based zero /// downtime deployments. /// /// public string MainDomKeyDiscriminator { get; set; } = string.Empty; /// /// Gets or sets the duration (in milliseconds) for which the MainDomLock release signal polling task should sleep. /// /// /// Doesn't apply to MainDomSemaphoreLock. /// /// The default value is 2000ms. /// /// [DefaultValue(StaticMainDomReleaseSignalPollingInterval)] public int MainDomReleaseSignalPollingInterval { get; set; } = StaticMainDomReleaseSignalPollingInterval; /// /// Gets or sets the telemetry ID. /// public string Id { get; set; } = string.Empty; /// /// Gets or sets a value for the path to the no content view. /// [DefaultValue(StaticNoNodesViewPath)] public string NoNodesViewPath { get; set; } = StaticNoNodesViewPath; /// /// Gets or sets a value for the database server registrar settings. /// public DatabaseServerRegistrarSettings DatabaseServerRegistrar { get; set; } = new(); /// /// Gets or sets a value for the database server messenger settings. /// public DatabaseServerMessengerSettings DatabaseServerMessenger { get; set; } = new(); /// /// Gets or sets a value for the SMTP settings. /// public SmtpSettings? Smtp { get; set; } /// /// Gets a value indicating whether SMTP is configured. /// public bool IsSmtpServerConfigured => !string.IsNullOrWhiteSpace(Smtp?.Host); /// /// Gets a value indicating whether there is a physical pickup directory configured. /// public bool IsPickupDirectoryLocationConfigured => !string.IsNullOrWhiteSpace(Smtp?.PickupDirectoryLocation); /// /// Gets or sets a value indicating whether TinyMCE scripting sanitization should be applied. /// [DefaultValue(StaticSanitizeTinyMce)] public bool SanitizeTinyMce { get; set; } = StaticSanitizeTinyMce; /// /// Gets or sets a value representing the maximum time to wait whilst attempting to obtain a distributed read lock. /// /// /// The default value is 60 seconds. /// [DefaultValue(StaticDistributedLockingReadLockDefaultTimeout)] public TimeSpan DistributedLockingReadLockDefaultTimeout { get; set; } = TimeSpan.Parse(StaticDistributedLockingReadLockDefaultTimeout); /// /// Gets or sets a value representing the maximum time to wait whilst attempting to obtain a distributed write lock. /// /// /// The default value is 5 seconds. /// [DefaultValue(StaticDistributedLockingWriteLockDefaultTimeout)] public TimeSpan DistributedLockingWriteLockDefaultTimeout { get; set; } = TimeSpan.Parse(StaticDistributedLockingWriteLockDefaultTimeout); /// /// Gets or sets a value representing the DistributedLockingMechanism to use. /// public string DistributedLockingMechanism { get; set; } = string.Empty; /// /// Force url paths to be left to right, even when the culture has right to left text /// /// /// For the following hierarchy /// - Root (/ar) /// - 1 (/ar/1) /// - 2 (/ar/1/2) /// - 3 (/ar/1/2/3) /// - 3 (/ar/1/2/3/4) /// When forced /// - https://www.umbraco.com/ar/1/2/3/4 /// when not /// - https://www.umbraco.com/ar/4/3/2/1 /// [DefaultValue(StaticForceCombineUrlPathLeftToRight)] public bool ForceCombineUrlPathLeftToRight { get; set; } = StaticForceCombineUrlPathLeftToRight; }