Update levant service template with some defaults
This commit is contained in:
parent
af32c9e2e5
commit
3bfc1f61ac
@ -219,7 +219,7 @@ EOF
|
||||
}
|
||||
[[ end -]]
|
||||
}
|
||||
[[ with .mysql_bootstrap ]][[ with . | parseJSON -]]
|
||||
[[ with .mysql_bootstrap ]][[ with . | parseJSON ]]
|
||||
task "[[$.name]]-bootstrap" {
|
||||
driver = "docker"
|
||||
|
||||
@ -260,15 +260,12 @@ password={{ .Data.data.root_password }}
|
||||
template {
|
||||
data = <<EOF
|
||||
{{ with secret "[[.vault_key]]" -}}
|
||||
{{ if .Data.data.[[.db_name_key]] -}}
|
||||
CREATE DATABASE IF NOT EXISTS `{{ .Data.data.[[.db_name_key]] }}`
|
||||
CREATE DATABASE IF NOT EXISTS `{{ .Data.data.[[ default "db_name" .db_name_key ]] }}`
|
||||
CHARACTER SET = 'utf8mb4'
|
||||
COLLATE = 'utf8mb4_unicode_ci';
|
||||
CREATE USER IF NOT EXISTS '{{ .Data.data.[[.db_user_key]] }}'@'%'
|
||||
IDENTIFIED BY '{{ .Data.data.[[.db_pass_key]] }}';
|
||||
GRANT ALL ON `{{ .Data.data.[[.db_name_key]] }}`.* to '{{ .Data.data.[[.db_user_key]] }}'@'%';
|
||||
{{ else -}}
|
||||
SELECT 'NOOP';
|
||||
CREATE USER IF NOT EXISTS '{{ .Data.data.[[ default "db_user" .db_user_key ]] }}'@'%'
|
||||
IDENTIFIED BY '{{ .Data.data.[[ default "db_pass" .db_pass_key ]] }}';
|
||||
GRANT ALL ON `{{ .Data.data.[[ default "db_name" .db_name_key ]] }}`.* to '{{ .Data.data.[[ default "db_user" .db_user_key ]] }}'@'%';
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
EOF
|
||||
|
Loading…
Reference in New Issue
Block a user