diff --git a/config/initializers/app_artifacts.rb b/config/initializers/app_artifacts.rb index b3e953a78f8..c91c1b1be7f 100644 --- a/config/initializers/app_artifacts.rb +++ b/config/initializers/app_artifacts.rb @@ -1,11 +1,12 @@ require 'app_artifacts' AppArtifacts.setup do |store| - # When adding or removing certs, make sure to update the 'saml_endpoint_configs' config - store.add_artifact(:saml_2021_cert, '/%s/saml2021.crt') - store.add_artifact(:saml_2021_key, '/%s/saml2021.key.enc') - store.add_artifact(:saml_2022_cert, '/%s/saml2022.crt') - store.add_artifact(:saml_2022_key, '/%s/saml2022.key.enc') + years = IdentityConfig.store.saml_endpoint_configs.pluck(:suffix) + + years.each do |year| + store.add_artifact(:"saml_{year}_cert", "/%s/saml#{year}.crt") + store.add_artifact(:"saml_{year}_key", '/%s/saml{year}.key.enc') + end store.add_artifact(:oidc_private_key, '/%s/oidc.key') { |k| OpenSSL::PKey::RSA.new(k) } store.add_artifact(:oidc_public_key, '/%s/oidc.pub') { |k| OpenSSL::PKey::RSA.new(k) }