Merge pull request #1471 from jakeprem/jakeprem/add-kamal-host-var
feat: Add KAMAL_HOST to app and accessory containers
This commit is contained in:
@@ -24,11 +24,11 @@ class Kamal::Cli::Accessory < Kamal::Cli::Base
|
||||
directories(name)
|
||||
upload(name)
|
||||
|
||||
on(hosts) do
|
||||
on(hosts) do |host|
|
||||
execute *KAMAL.auditor.record("Booted #{name} accessory"), verbosity: :debug
|
||||
execute *accessory.ensure_env_directory
|
||||
upload! accessory.secrets_io, accessory.secrets_path, mode: "0600"
|
||||
execute *accessory.run
|
||||
execute *accessory.run(host: host)
|
||||
|
||||
if accessory.running_proxy?
|
||||
target = capture_with_info(*accessory.container_id_for(container_name: accessory.service_name, only_running: true)).strip
|
||||
|
||||
@@ -12,11 +12,12 @@ class Kamal::Commands::Accessory < Kamal::Commands::Base
|
||||
@accessory_config = config.accessory(name)
|
||||
end
|
||||
|
||||
def run
|
||||
def run(host: nil)
|
||||
docker :run,
|
||||
"--name", service_name,
|
||||
"--detach",
|
||||
"--restart", "unless-stopped",
|
||||
*([ "-e", "KAMAL_HOST=\"#{host}\"" ] if host),
|
||||
*network_args,
|
||||
*config.logging_args,
|
||||
*publish_args,
|
||||
|
||||
@@ -22,6 +22,7 @@ class Kamal::Commands::App < Kamal::Commands::Base
|
||||
*([ "--hostname", hostname ] if hostname),
|
||||
"-e", "KAMAL_CONTAINER_NAME=\"#{container_name}\"",
|
||||
"-e", "KAMAL_VERSION=\"#{config.version}\"",
|
||||
"-e", "KAMAL_HOST=\"#{host}\"",
|
||||
*role.env_args(host),
|
||||
*role.logging_args,
|
||||
*config.volume_args,
|
||||
|
||||
Reference in New Issue
Block a user