Clean up services template whitespace

This commit is contained in:
IamTheFij 2022-07-27 14:41:42 -07:00
parent 547cd96e4c
commit 9664802fb6

View File

@ -28,14 +28,14 @@ job "[[.name]]" {
[[ with .count ]]count = [[ . ]][[ end ]]
network {
mode = "bridge"
[[ if not (empty .service_port) ]]
[[ if not (empty .service_port) -]]
port "main" {
[[ if default false .ingress ]]
[[ if default false .ingress -]]
host_network = "loopback"
[[ end ]]
[[ end -]]
to = [[ .service_port ]]
}
[[ end ]]
[[ end -]]
}
[[ if default false .sticky_disk ]]
@ -55,18 +55,18 @@ job "[[.name]]" {
sidecar_service {
proxy {
local_service_port = [[ .service_port ]]
[[ if default false .mysql ]]
[[ if default false .mysql -]]
upstreams {
destination_name = "mysql-server"
local_bind_port = 4040
}
[[ end -]]
[[ if default false .redis ]]
[[ if default false .redis -]]
upstreams {
destination_name = "redis"
local_bind_port = 6379
}
[[ end ]]
[[ end -]]
}
}
@ -97,7 +97,7 @@ job "[[.name]]" {
[[ end -]]
]
}
[[ end ]]
[[ end -]]
task "[[.name]]" {
driver = "docker"
@ -106,20 +106,20 @@ job "[[.name]]" {
image = "[[.image]]"
[[ if not (empty .service_port) -]]
ports = ["main"]
[[- end ]]
[[ end -]]
[[ if not (empty .args) -]]
args = ["[[ .args | parseJSON | join `", "` ]]"]
[[- end ]]
[[ end -]]
[[ with .templates]]
[[ range $t := . | parseJSON ]]
[[ with .templates -]]
[[ range $t := . | parseJSON -]]
mount {
type = "bind"
target = "[[ $t.dest ]]"
source = "local/[[ $t.dest ]]"
}
[[ end ]]
[[ end ]]
[[ end -]]
}
[[ if default false .vault -]]
@ -133,14 +133,14 @@ job "[[.name]]" {
[[ with .env -]]
env = {
[[- range $k, $v := . ]]
[[ range $k, $v := . -]]
"[[$k]]" = "[[$v]]"
[[- end ]]
[[ end -]]
}
[[ end ]]
[[ end -]]
[[ with .templates ]]
[[ range $t := . | parseJSON ]]
[[ with .templates -]]
[[ range $t := . | parseJSON -]]
template {
data = <<EOF
[[ $t.data ]]
@ -152,15 +152,15 @@ EOF
[[ with $t.change_signal ]]change_signal = "[[ . ]]"[[ end -]]
[[ with $t.env ]]env = [[ . ]][[ end ]]
}
[[ end ]]
[[ end ]]
[[ end -]]
[[ end -]]
[[ with .resources ]]
[[ with .resources -]]
resources {
cpu = [[ .cpu ]]
memory = [[ .memory ]]
}
[[ end ]]
[[ end -]]
}
}
}