Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Shushlin <vshushlin@gitlab.com>2019-06-06 22:14:09 +0300
committerNick Thomas <nick@gitlab.com>2019-06-06 22:14:09 +0300
commitd1d05ae4f34aab350db86e03859c97e90f515520 (patch)
treec318ad0a14b556b7bacafc7e042219ae44687c92 /app/models/pages_domain.rb
parentbb02557cbd1e8a7c97fac4c24c40e6e02c809a9a (diff)
Add certificate valid time to pages domain table
Save certificate validity time for pages domains on save Fill validity time for existing pages domains in background migration
Diffstat (limited to 'app/models/pages_domain.rb')
-rw-r--r--app/models/pages_domain.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/models/pages_domain.rb b/app/models/pages_domain.rb
index 5c3441791fd..524df30289e 100644
--- a/app/models/pages_domain.rb
+++ b/app/models/pages_domain.rb
@@ -135,6 +135,14 @@ class PagesDomain < ApplicationRecord
"#{VERIFICATION_KEY}=#{verification_code}"
end
+ def certificate=(certificate)
+ super(certificate)
+
+ # set nil, if certificate is nil
+ self.certificate_valid_not_before = x509&.not_before
+ self.certificate_valid_not_after = x509&.not_after
+ end
+
private
def set_verification_code
@@ -187,7 +195,7 @@ class PagesDomain < ApplicationRecord
end
def x509
- return unless certificate
+ return unless certificate.present?
@x509 ||= OpenSSL::X509::Certificate.new(certificate)
rescue OpenSSL::X509::CertificateError