internal void ValidateAllowedDestinations() { if (AllowedDestinations == null) { return; } if (AllowedDestinations.Contains(_noneDestination, StringComparer.OrdinalIgnoreCase)) { if (AllowedDestinations.Length > 1) { throw new ArgumentException($"If you specify \"None\" under '{RavenConfiguration.GetKey(x => x.Backup.AllowedDestinations)}' then it must be the only value."); } return; } foreach (var dest in AllowedDestinations) { if (_allDestinations.Contains(dest, StringComparer.OrdinalIgnoreCase)) { continue; } throw new ArgumentException($"The destination '{dest}' defined in the configuration under '{RavenConfiguration.GetKey(x => x.Backup.AllowedDestinations)}' is unknown. Make sure to use the following destinations: {string.Join(", ", _allDestinations)}."); } }
public void AssertDestinationAllowed(string dest) { if (AllowedDestinations == null) { return; } if (AllowedDestinations.Contains("None")) { throw new ArgumentException("Backups are not allowed in this RavenDB server. Contact the administrator for more information."); } if (AllowedDestinations.Contains(dest)) { return; } throw new ArgumentException($"The selected backup destination '{dest}' is not allowed in this RavenDB server. Contact the administrator for more information. Allowed backup destinations: {string.Join(", ", AllowedDestinations)}"); }