Move hosts/roles specification to cli args instead of ENV

This commit is contained in:
David Heinemeier Hansson
2023-01-20 16:57:25 +01:00
parent 0388495819
commit 79b5ed179e
13 changed files with 87 additions and 66 deletions

View File

@@ -16,6 +16,22 @@ class Mrsk::Commander
@config ||= Mrsk::Configuration.create_from(config_file, destination: destination).tap { |config| setup_with(config) }
end
def hosts=(hosts)
@hosts = hosts if hosts.present?
end
def roles=(role_names)
@hosts = config.roles.select { |r| role_names.include?(r.name) }.flat_map(&:hosts) if role_names.present?
end
def hosts
@hosts || config.all_hosts
end
def traefik_hosts
@hosts || config.traefik_hosts
end
def app
@app ||= Mrsk::Commands::App.new(config)