Skip to content

Commit

Permalink
update code samples
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Buchleitner <[email protected]>
  • Loading branch information
mabunixda committed Oct 24, 2024
1 parent 1bd1cb7 commit 2daa497
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion nomad/app_dynamic.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ job "dynamic-app" {
{{end}}
{{ with secret "dynamic-app/kv/database" }}
Database = {{ .Data.database }}
Database = {{ .Data.data.database }}
{{ end }}
{{ with secret "dynamic-app/db/creds/app" }}
User = {{ .Data.username }}
Expand Down
6 changes: 3 additions & 3 deletions nomad/app_static.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ job "dynamic-app" {
{{end}}
{{ with secret "dynamic-app/kv/database" }}
Database = {{ .Data.database }}
User = {{ .Data.username }}
Password = {{ .Data.password }}
Database = {{ .Data.data.database }}
User = {{ .Data.data.username }}
Password = {{ .Data.data.password }}
{{ end }}
[VAULT]
Enabled = False
Expand Down
4 changes: 3 additions & 1 deletion nomad/app_transit.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ job "dynamic-app" {
Port = {{ .Port }}
{{end}}
Database = my_app
{{ with secret "dynamic-app/kv/database" }}
Database = {{ .Data.data.database }}
{{ end }}
{{ with secret "dynamic-app/db/creds/app" }}
User = {{ .Data.username }}
Password = {{ .Data.password }}
Expand Down
2 changes: 1 addition & 1 deletion nomad/app_transit_connect.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ job "dynamic-app" {
Port = 3306
{{ with secret "dynamic-app/kv/database" }}
Database = {{ .Data.database }}
Database = {{ .Data.data.database }}
{{ end }}
{{ with secret "dynamic-app/db/creds/app" }}
User = {{ .Data.username }}
Expand Down
2 changes: 1 addition & 1 deletion nomad/app_transit_connect_traefik.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ job "dynamic-app" {
Port = 3306
{{ with secret "dynamic-app/kv/database" }}
Database = {{ .Data.database }}
Database = {{ .Data.data.database }}
{{ end }}
{{ with secret "dynamic-app/db/creds/app" }}
User = {{ .Data.username }}
Expand Down
8 changes: 4 additions & 4 deletions nomad/mysql_connect.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ job "mysql-server" {
env = true
data = <<EOF
{{ with secret "dynamic-app/kv/database" }}
MYSQL_DATABASE = "{{ .Data.database }}"
MYSQL_USER = "{{ .Data.username }}"
MYSQL_PASSWORD = "{{ .Data.password }}"
MYSQL_DATABASE = "{{ .Data.data.database }}"
MYSQL_USER = "{{ .Data.data.username }}"
MYSQL_PASSWORD = "{{ .Data.data.password }}"
{{ end }}
{{ with secret "dynamic-app/kv/database_root" }}
MYSQL_ROOT_PASSWORD = "{{ .Data.password }}"
MYSQL_ROOT_PASSWORD = "{{ .Data.data.password }}"
{{ end }}
EOF
}
Expand Down
9 changes: 4 additions & 5 deletions nomad/mysql_static.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,18 @@ job "mysql-server" {
]
}
template {
env = true
destination = "secrets/.envs"
change_mode = "noop"
env = true
data = <<EOF
{{ with secret "dynamic-app/kv/database" }}
MYSQL_DATABASE = "{{ .Data.database }}"
MYSQL_USER = "{{ .Data.username }}"
MYSQL_PASSWORD = "{{ .Data.password }}"
MYSQL_DATABASE = "{{ .Data.data.database }}"
MYSQL_USER = "{{ .Data.data.username }}"
MYSQL_PASSWORD = "{{ .Data.data.password }}"
{{ end }}
{{ with secret "dynamic-app/kv/database_root" }}
MYSQL_ROOT_PASSWORD = "{{ .Data.password }}"
MYSQL_ROOT_PASSWORD = "{{ .Data.data.password }}"
{{ end }}
EOF
}
Expand Down
1 change: 0 additions & 1 deletion nomad/whoami.hcl
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
job "whoami" {
datacenters = ["dc1"]
type = "service"
namespace = "demo"

group "whoami" {
count = 1
Expand Down

0 comments on commit 2daa497

Please sign in to comment.