Skip to content

Conversation

@ShPakvel
Copy link
Contributor

Summary

This PR adds .kamal/options.yml file as storage for default options used with kamal commands.

It implements proposal-issue to set default deploy config file with different location. To eliminate necessity applying option with each kamal command, like kamal deploy -c .kamal/deploy.yml, or with often run manually alias-commands.

Closes #1424

This foundation should be easily applicable for other options. E.g. to allow destination default from .kamal/options.yml file, change should be as minimal as following:

-            destination: options[:destination],
+            destination: option_with_default_from_file(:destination),

Changes

  • Add check for default options from .kamal/options.yml file.
  • Add config_file option check, with backward-compatible fallback to config/deploy.yml value.
  • Add .kamal/options.yml creation on kamal init command. Existing option -c can be used during initialization to provide default config file. It will be stored into .kamal/options.yml. If not provided, backward-compatible config/deploy.yml will be stored.
  • Cover .kamal/options.yml with tests.

Note: This PR preserves backward-compatibility with current behavior. This feature is extension without breaking stuff.

- Add check for default options from `.kamal/options.yml` file.
- Add `config_file` option check, with backward-compatible fallback to `config/deploy.yml` value.
- Add `.kamal/options.yml` creation on `kamal init` command. Existing option `-c` can be used during initialization to provide default config file. It will be stored into `.kamal/options.yml`. If not provided, backward-compatible `config/deploy.yml` will be stored.
- Cover `.kamal/options.yml` with tests.

Note: Changes preserve backward-compatibility with current behavior. This feature is extension without breaking stuff.
@grafst
Copy link

grafst commented Apr 14, 2025

This is would also be very useful when using a project that has a "config" file like radicale for example.

@ShPakvel
Copy link
Contributor Author

@djmb, Do you have this idea in consideration?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set default deploy config on kamal init.

2 participants