Dynamically build the connection_string with options for the spire server when spire-server.dataStore.sql.databaseType == sqlite3 (#576)
Signed-off-by: Daniel Schlatter <[email protected]>
This commit is contained in:
@@ -131,7 +131,8 @@ In order to run Tornjak with simple HTTP Connection only, make sure you don't cr
|
||||
| `dataStore.sql.port` | If 0 (default), it will auto set to 5432 for postgres and 3306 for mysql. Only used by those databases. | `0` |
|
||||
| `dataStore.sql.username` | Only used when type != "sqlite3" | `spire` |
|
||||
| `dataStore.sql.password` | Only used when type != "sqlite3" | `""` |
|
||||
| `dataStore.sql.options` | Only used when type != "sqlite3" | `[]` |
|
||||
| `dataStore.sql.file` | Data source file. Only used when type == "sqlite3" | `/run/spire/data/datastore.sqlite3` |
|
||||
| `dataStore.sql.options` | takes an array of objects of form {<key>: <value>} to use when building the database connection string | `[]` |
|
||||
| `dataStore.sql.rootCAPath` | Path to Root CA bundle (MySQL only) | `""` |
|
||||
| `dataStore.sql.clientCertPath` | Path to client certificate (MySQL only) | `""` |
|
||||
| `dataStore.sql.clientKeyPath` | Path to private key for client certificate (MySQL only) | `""` |
|
||||
|
||||
@@ -161,6 +161,20 @@ Create the name of the service account to use
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "spire-server.config-sqlite-query" }}
|
||||
{{- $lst := list }}
|
||||
{{- range . }}
|
||||
{{- range $key, $value := . }}
|
||||
{{- $eValue := toString $value }}
|
||||
{{- $entry := printf "%s=%s" (urlquery $key) (urlquery $eValue) }}
|
||||
{{- $lst = append $lst $entry }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if gt (len $lst) 0 }}
|
||||
{{- printf "?%s" (join "&" (uniq $lst)) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "spire-server.config-mysql-query" }}
|
||||
{{- $lst := list }}
|
||||
{{- range . }}
|
||||
@@ -194,7 +208,8 @@ Create the name of the service account to use
|
||||
{{- $ropw := "" }}
|
||||
{{- if eq .Values.dataStore.sql.databaseType "sqlite3" }}
|
||||
{{- $_ := set $config "database_type" "sqlite3" }}
|
||||
{{- $_ := set $config "connection_string" "/run/spire/data/datastore.sqlite3" }}
|
||||
{{- $query := include "spire-server.config-sqlite-query" .Values.dataStore.sql.options }}
|
||||
{{- $_ := set $config "connection_string" (printf "%s%s" .Values.dataStore.sql.file $query) }}
|
||||
{{- else if or (eq .Values.dataStore.sql.databaseType "mysql") (eq .Values.dataStore.sql.databaseType "aws_mysql") }}
|
||||
{{- if eq .Values.dataStore.sql.databaseType "mysql" }}
|
||||
{{- $_ := set $config "database_type" "mysql" }}
|
||||
|
||||
@@ -167,7 +167,9 @@ dataStore:
|
||||
username: spire
|
||||
## @param dataStore.sql.password Only used when type != "sqlite3"
|
||||
password: ""
|
||||
## @param dataStore.sql.options [array] Only used when type != "sqlite3"
|
||||
## @param dataStore.sql.file Data source file. Only used when type == "sqlite3"
|
||||
file: "/run/spire/data/datastore.sqlite3"
|
||||
## @param dataStore.sql.options [array] takes an array of objects of form {<key>: <value>} to use when building the database connection string
|
||||
options: []
|
||||
|
||||
## @param dataStore.sql.rootCAPath Path to Root CA bundle (MySQL only)
|
||||
|
||||
Reference in New Issue
Block a user