public override void Default(ScheduledRenewal renewal, IOptionsService optionsService) { var siteId = optionsService.TryGetLong(nameof(optionsService.Options.FtpSiteId), optionsService.Options.FtpSiteId) ?? optionsService.TryGetLong(nameof(optionsService.Options.InstallationSiteId), optionsService.Options.InstallationSiteId) ?? optionsService.TryGetLong(nameof(optionsService.Options.SiteId), optionsService.Options.SiteId) ?? throw new Exception($"Missing parameter --{nameof(optionsService.Options.FtpSiteId).ToLower()}"); var site = _iisClient.GetFtpSite(siteId); renewal.Binding.FtpSiteId = site.Id; }
public override void Default(ScheduledRenewal renewal, IOptionsService optionsService) { var siteId = optionsService.TryGetLong(nameof(optionsService.Options.FtpSiteId), optionsService.Options.FtpSiteId); if (siteId == null) { siteId = optionsService.TryGetLong(nameof(optionsService.Options.InstallationSiteId), optionsService.Options.InstallationSiteId); } if (siteId == null) { siteId = optionsService.TryGetLong(nameof(optionsService.Options.SiteId), optionsService.Options.SiteId); } if (siteId != null) { var site = _iisClient.GetFtpSite(siteId.Value); // Throws exception when not found renewal.Binding.InstallationSiteId = site.Id; } else { throw new Exception($"Missing parameter --{nameof(optionsService.Options.FtpSiteId).ToLower()}"); } }
public override void Default(Target target, IOptionsService optionsService) { if (target.IIS == true && _iisClient.Version.Major > 0) { var validationSiteId = optionsService.TryGetLong(nameof(optionsService.Options.ValidationSiteId), optionsService.Options.ValidationSiteId); if (validationSiteId != null) { var site = _iisClient.GetWebSite(validationSiteId.Value); // Throws exception when not found target.ValidationSiteId = validationSiteId; target.WebRootPath = site.WebRoot(); } } base.Default(target, optionsService); }