Skip to content

Commit

Permalink
Ensure we don't load the secrets more than once
Browse files Browse the repository at this point in the history
Secrets were being created twice, which might require logging in twice.
  • Loading branch information
djmb committed Sep 17, 2024
1 parent 190dbd1 commit f183419
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/kamal/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f183419

Please sign in to comment.