Some cleanup of service template whitespace

This commit is contained in:
IamTheFij 2023-03-02 10:42:33 -08:00
parent f41bdb7dd0
commit 882fe7e29c

View File

@ -9,37 +9,34 @@ job "${name}" {
mode = "bridge" mode = "bridge"
%{ if service_port != null ~} %{ if service_port != null ~}
port "main" { port "main" {
%{ if ingress ~} %{ if ingress }
host_network = "loopback" host_network = "loopback"
%{ endif ~} %{~ endif }
to = ${service_port} to = ${service_port}
} }
%{ endif ~} %{ endif }
} }
%{ if length(group_meta) > 0 ~} %{ if length(group_meta) > 0 }
meta = { meta = {
%{ for k, v in group_meta ~} %{ for k, v in group_meta }
${k} = ${jsonencode(v)} ${k} = ${jsonencode(v)}
%{ endfor ~} %{ endfor }
} }
%{~ endif }
%{ endif ~} %{ if sticky_disk }
%{ if sticky_disk ~}
ephemeral_disk { ephemeral_disk {
migrate = true migrate = true
sticky = true sticky = true
} }
%{~ endif }
%{ endif ~} %{ for host_volume in host_volumes }
%{ for host_volume in host_volumes ~}
volume "${host_volume.name}" { volume "${host_volume.name}" {
type = "host" type = "host"
read_only = ${host_volume.read_only} read_only = ${host_volume.read_only}
source = "${host_volume.name}" source = "${host_volume.name}"
} }
%{ endfor }
%{ endfor ~}
%{ if service_port != null ~} %{ if service_port != null ~}
service { service {
name = "${replace(name, "_", "-")}" name = "${replace(name, "_", "-")}"
@ -86,8 +83,8 @@ job "${name}" {
} }
} }
%{ endif ~} %{~ endif }
%{ if healthcheck_path != null ~} %{ if healthcheck_path != null }
check { check {
type = "http" type = "http"
path = "${healthcheck_path}" path = "${healthcheck_path}"
@ -104,7 +101,7 @@ job "${name}" {
%{ endif ~} %{ endif ~}
tags = [ tags = [
%{ if ingress ~} %{ if ingress }
"traefik.enable=true", "traefik.enable=true",
"traefik.http.routers.${name}.entryPoints=websecure", "traefik.http.routers.${name}.entryPoints=websecure",
%{ if try(ingress_rule, null) != null ~} %{ if try(ingress_rule, null) != null ~}
@ -112,8 +109,8 @@ job "${name}" {
%{ endif ~} %{ endif ~}
%{ for middleware in ingress_middlewares ~} %{ for middleware in ingress_middlewares ~}
"traefik.http.routers.${name}.middlewares=${middleware}", "traefik.http.routers.${name}.middlewares=${middleware}",
%{ endfor ~} %{~ endfor }
%{ endif ~} %{~ endif }
] ]
} }