Skip to content

Destination config files don't preserve base file extension #1630

@delkopiso

Description

@delkopiso

When using custom config files with the --config-file option combined with the -d (destination) flag, Kamal hardcodes the .yml extension for destination-specific config files, regardless of the base config file's extension.

Current Behavior

If you use a config file with .yaml extension:

kamal deploy --config-file my-app.yaml -d staging

Kamal will:

  • Load my-app.yaml ✅ (works correctly)
  • Look for my-app.staging.yml ❌ (hardcoded .yml extension)

This inconsistency means users must use different extensions for their base and destination files when using .yaml.

Expected Behavior

The destination config file should preserve the same extension as the base config file:

  • Base file: my-app.yaml → Destination file: my-app.staging.yaml
  • Base file: my-app.yml → Destination file: my-app.staging.yml

Root Cause

In lib/kamal/configuration.rb:42, the destination_config_file method hardcodes the .yml extension:

def destination_config_file(base_config_file, destination)
  base_config_file.sub_ext(".#{destination}.yml") if destination  # ❌ hardcoded .yml
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions