Added network_args to proxy configuration
This commit is contained in:
@@ -4,7 +4,7 @@ class Kamal::Commands::Proxy < Kamal::Commands::Base
|
|||||||
def run
|
def run
|
||||||
docker :run,
|
docker :run,
|
||||||
"--name", container_name,
|
"--name", container_name,
|
||||||
"--network", "kamal",
|
*config.network_args,
|
||||||
"--detach",
|
"--detach",
|
||||||
"--restart", "unless-stopped",
|
"--restart", "unless-stopped",
|
||||||
"--volume", "kamal-proxy-config:/home/kamal-proxy/.config/kamal-proxy",
|
"--volume", "kamal-proxy-config:/home/kamal-proxy/.config/kamal-proxy",
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ class Kamal::Configuration::Proxy
|
|||||||
|
|
||||||
DEFAULT_LOG_REQUEST_HEADERS = [ "Cache-Control", "Last-Modified", "User-Agent" ]
|
DEFAULT_LOG_REQUEST_HEADERS = [ "Cache-Control", "Last-Modified", "User-Agent" ]
|
||||||
CONTAINER_NAME = "kamal-proxy"
|
CONTAINER_NAME = "kamal-proxy"
|
||||||
|
NETWORK = "kamal"
|
||||||
|
|
||||||
delegate :argumentize, :optionize, to: Kamal::Utils
|
delegate :argumentize, :optionize, to: Kamal::Utils
|
||||||
|
|
||||||
@@ -51,6 +52,10 @@ class Kamal::Configuration::Proxy
|
|||||||
optionize ({ target: "#{target}:#{app_port}" }).merge(deploy_options), with: "="
|
optionize ({ target: "#{target}:#{app_port}" }).merge(deploy_options), with: "="
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def network_args
|
||||||
|
argumentize "--network", network
|
||||||
|
end
|
||||||
|
|
||||||
def merge(other)
|
def merge(other)
|
||||||
self.class.new config: config, proxy_config: proxy_config.deep_merge(other.proxy_config)
|
self.class.new config: config, proxy_config: proxy_config.deep_merge(other.proxy_config)
|
||||||
end
|
end
|
||||||
@@ -59,4 +64,8 @@ class Kamal::Configuration::Proxy
|
|||||||
def seconds_duration(value)
|
def seconds_duration(value)
|
||||||
value ? "#{value}s" : nil
|
value ? "#{value}s" : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def network
|
||||||
|
proxy_config["network"] || NETWORK
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user