Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure we don't load the secrets more than once #944

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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