/// <summary> /// We store a target next renewal attempt, to avoid hitting let's encrypt api rate limits. /// </summary> /// <param name="hostName"></param> protected CertificateRenewalState GetCertificateRenewalState(string hostName) { // This is to support legacy storage migration, remove in future versions. var legacyValue = this.Deployment.GetSettingPersistent <DateTime?>("ssl-last-renewal-attempt" + "@" + hostName, null, this.Logger); string key = hostName.Replace(".", "_"); if (this.SimpleStoreRenewalStatus.Get <CertificateRenewalState>(key, out var storeItem)) { return(storeItem.Data); } var result = new CertificateRenewalState() { HostName = hostName, NextRenewal = legacyValue }; this.StoreCertificateRenewalState(result); return(result); }
/// <summary> /// /// </summary> /// <param name="state"></param> protected void StoreCertificateRenewalState(CertificateRenewalState state) { string key = state.HostName.Replace(".", "_"); this.SimpleStoreRenewalStatus.Set(key, state); }