diff options
author | Vladimir Shushlin <vshushlin@gitlab.com> | 2019-06-06 13:20:15 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-06-06 13:20:15 +0000 |
commit | 3aab750d076774b2adef9493171f29ea3b4523d6 (patch) | |
tree | 378f59649da7e96297eac454a56e80cd2dfb7096 /app/models/pages_domain.rb | |
parent | 0a5020b494e88719fb8b8d6a5039b450a98081fb (diff) | |
download | gitlab-ce-3aab750d076774b2adef9493171f29ea3b4523d6.tar.gz |
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.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/models/pages_domain.rb b/app/models/pages_domain.rb index 407d85b1520..8313d33f101 100644 --- a/app/models/pages_domain.rb +++ b/app/models/pages_domain.rb @@ -134,6 +134,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 @@ -186,7 +194,7 @@ class PagesDomain < ApplicationRecord end def x509 - return unless certificate + return unless certificate.present? @x509 ||= OpenSSL::X509::Certificate.new(certificate) rescue OpenSSL::X509::CertificateError |