Skip to content

Commit

Permalink
fix(templates) Use quote when possible
Browse files Browse the repository at this point in the history
Fix harbor backend templating

Signed-off-by: Pierre Péronnet <pierre.peronnet@corp.ovh.com>
  • Loading branch information
holyhope committed Jan 31, 2020
1 parent 91d1271 commit 43b9bc4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion assets/templates/chartmuseum/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ prov.post.form.field.name: prov
storage:
{{- range file.Walk ( env.Getenv "STORAGE_CONFIG" ) }}
{{- if not ( file.IsDir . ) }}
backend: {{ filepath.Base . | strings.Indent 2 " " }}
backend: {{ filepath.Base . | strings.quote }}
{{- "\n" -}}{{ file.Read . | data.YAML | data.ToYAML | strings.Indent 1 " " }}
{{- end }}
{{- end }}
3 changes: 1 addition & 2 deletions assets/templates/clair/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ clair:
database:
type: pgsql
options:
source: postgresql://{{ env.Getenv "username" }}:{{ env.Getenv "password" }}@{{ env.Getenv "host" }}:{{ env.Getenv "port" "5432" }}/{{ env.Getenv "database" }}
{{- if gt ( len ( env.Getenv "ssl" ) ) 0 -}}?sslmode={{ env.Getenv "ssl" }}{{- end }}
source: {{ print "postgresql://%s:%s@%s:%d/%s?sslmode=%s" (env.Getenv "username") (env.Getenv "password") (env.Getenv "host") (env.Getenv "port" "5432") (env.Getenv "database") (env.Getenv "ssl") | quote }}
updater:
interval: 0s
enabledupdaters:
Expand Down
4 changes: 2 additions & 2 deletions assets/templates/registry/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ notifications:
endpoints:
- name: harbor-core
disabled: false
url: "http://{{ env.Getenv "CORE_HOSTNAME" }}/service/notifications"
url: {{ env.Getenv "CORE_HOSTNAME" | print "http://%s/service/notifications" | quote }}
timeout: 3000ms
threshold: 5
backoff: 1s
Expand All @@ -48,7 +48,7 @@ auth:
{{- if gt ( len $redisUrl ) 0 }}
{{- with (conv.URL $redisUrl) }}
redis:
addr: {{ .Host | quote }}
addr: {{ quote .Host }}
{{- if strings.Contains "@" . }}
{{- /* cannot get password from $redis.User.Password, only a single non error result is permitted */ -}}
{{- with ( index ( strings.SplitN "@" 2 ( index ( strings.SplitN "/" 2 ( index ( strings.SplitN "://" 2 .String ) 1 ) ) 0 ) ) 0 ) }}
Expand Down

0 comments on commit 43b9bc4

Please sign in to comment.