Added volume configuration in response to issue coments

This commit is contained in:
Stephen van Beek
2023-03-14 19:55:37 +00:00
parent 2cea12c56b
commit 2db1bfde00
3 changed files with 58 additions and 15 deletions

View File

@@ -9,7 +9,7 @@ class Mrsk::Commands::Traefik < Mrsk::Commands::Base
"--restart", "unless-stopped",
"--log-opt", "max-size=#{MAX_LOG_SIZE}",
*published_ports,
"--volume", "/var/run/docker.sock:/var/run/docker.sock",
*volumes,
"traefik",
"--providers.docker",
"--log.level=DEBUG",
@@ -55,13 +55,21 @@ class Mrsk::Commands::Traefik < Mrsk::Commands::Base
private
def published_ports
if args = config.raw_config.dig(:traefik, "ports")
args.collect { |value| "--publish #{value}:#{value}" }.compact
if ports = config.raw_config.dig(:traefik, "options", "publish")
ports.collect { |value| "--publish #{value}:#{value}" }.compact
else
["--publish #{port}"]
end
end
def volumes
if volumes = config.raw_config.dig(:traefik, "options", "volumes")
volumes.collect { |value| "--volume #{value}" }.compact
else
["--volume /var/run/docker.sock:/var/run/docker.sock"]
end
end
def cmd_option_args
if args = config.traefik["args"]
optionize args, with: "="