public ConfigurationEntryServerValue(IConfiguration configuration, ConfigurationEntryMetadata metadata, RavenServer.AuthenticationStatus authenticationStatus)
            : base(metadata)
        {
            ServerValues = new Dictionary <string, ConfigurationEntrySingleValue>();
            foreach (var key in Metadata.Keys)
            {
                var value = configuration[key];
                if (value == null)
                {
                    continue;
                }

                var hasAccess = authenticationStatus == RavenServer.AuthenticationStatus.ClusterAdmin;
                ServerValues[key] = new ConfigurationEntrySingleValue
                {
                    Value     = hasAccess && Metadata.IsSecured == false ? value : null,
                    HasAccess = hasAccess,
                    HasValue  = true,
                };
            }
        }
        public ConfigurationEntryDatabaseValue(RavenConfiguration configuration, DatabaseRecord dbRecord, ConfigurationEntryMetadata metadata, RavenServer.AuthenticationStatus authenticationStatus)
            : base(configuration.ServerWideSettings, metadata, authenticationStatus)
        {
            if (Metadata.Scope == ConfigurationEntryScope.ServerWideOnly)
            {
                return;
            }

            DatabaseValues = new Dictionary <string, ConfigurationEntrySingleValue>();
            foreach (var key in Metadata.Keys)
            {
                bool canShowValue = Metadata.IsSecured == false;

                var hasValue = configuration.DoesKeyExistInSettings(key);
                var value    = configuration.GetSetting(key);

                if (dbRecord.Settings.TryGetValue(key, out var valueInDbRecord) == false)
                {
                    if (hasValue &&
                        string.Equals(key, RavenConfiguration.GetKey(x => x.Core.DataDirectory), StringComparison.OrdinalIgnoreCase) == false &&
                        string.Equals(key, RavenConfiguration.GetKey(x => x.Core.RunInMemory), StringComparison.OrdinalIgnoreCase) == false) // DataDirectory and RunInMemory are always set as in-memory values
                    {
                        // key does not exist in db record but current configuration has a value - deletion of an override is pending

                        DatabaseValues[key] = new ConfigurationEntrySingleValue
                        {
                            Value        = canShowValue ? value : null,
                            HasAccess    = true,
                            PendingValue = new ConfigurationEntrySinglePendingValue()
                            {
                                ValueDeleted = true,
                            }
                        };
                    }

                    continue;
                }

                string pendingValue    = null;
                var    hasPendingValue = false;

                if (hasValue)
                {
                    if (string.Equals(value, valueInDbRecord) == false)
                    {
                        pendingValue    = valueInDbRecord;
                        hasPendingValue = true;
                    }
                }
                else
                {
                    pendingValue    = valueInDbRecord;
                    hasPendingValue = true;
                }

                DatabaseValues[key] = new ConfigurationEntrySingleValue
                {
                    Value        = canShowValue ? value : null,
                    HasValue     = hasValue,
                    HasAccess    = true,
                    PendingValue = hasPendingValue == false ? null : new ConfigurationEntrySinglePendingValue()
                    {
                        HasValue = true,
                        Value    = canShowValue ? pendingValue : null
                    }
                };
            }
        }