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

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