Pass around Roles instead of Strings

Avoid looking up roles by names everywhere. This avoids the awkward
role/role_config naming as well.
This commit is contained in:
Donal McBreen
2024-03-08 08:44:35 +00:00
parent 52bb40add0
commit 4966d52919
12 changed files with 61 additions and 60 deletions

View File

@@ -8,9 +8,8 @@ class Kamal::Cli::Env < Kamal::Cli::Base
execute *KAMAL.auditor.record("Pushed env files"), verbosity: :debug
KAMAL.roles_on(host).each do |role|
role_config = KAMAL.config.role(role)
execute *KAMAL.app(role: role).make_env_directory
upload! StringIO.new(role_config.env_file), role_config.host_env_file_path, mode: 400
upload! StringIO.new(role.env_file), role.host_env_file_path, mode: 400
end
end
@@ -36,7 +35,6 @@ class Kamal::Cli::Env < Kamal::Cli::Base
execute *KAMAL.auditor.record("Deleted env files"), verbosity: :debug
KAMAL.roles_on(host).each do |role|
role_config = KAMAL.config.role(role)
execute *KAMAL.app(role: role).remove_env_file
end
end