From f183419f7ae250e5f926785927d31d16e06bdb29 Mon Sep 17 00:00:00 2001 From: Donal McBreen Date: Tue, 17 Sep 2024 14:21:43 +0100 Subject: [PATCH] Ensure we don't load the secrets more than once Secrets were being created twice, which might require logging in twice. --- lib/kamal/configuration.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/kamal/configuration.rb b/lib/kamal/configuration.rb index bd33b08c7..1d6dfd129 100644 --- a/lib/kamal/configuration.rb +++ b/lib/kamal/configuration.rb @@ -48,6 +48,8 @@ def initialize(raw_config, destination: nil, version: nil, validate: true) validate! raw_config, example: validation_yml.symbolize_keys, context: "", with: Kamal::Configuration::Validator::Configuration + @secrets = Kamal::Secrets.new(destination: destination) + # Eager load config to validate it, these are first as they have dependencies later on @servers = Servers.new(config: self) @registry = Registry.new(config: self) @@ -63,8 +65,6 @@ def initialize(raw_config, destination: nil, version: nil, validate: true) @ssh = Ssh.new(config: self) @sshkit = Sshkit.new(config: self) - @secrets = Kamal::Secrets.new(destination: destination) - ensure_destination_if_required ensure_required_keys_present ensure_valid_kamal_version @@ -259,10 +259,6 @@ def to_h }.compact end - def secrets - @secrets ||= Kamal::Secrets.new(destination: destination) - end - private # Will raise ArgumentError if any required config keys are missing def ensure_destination_if_required