Skip to content

Instantly share code, notes, and snippets.

@Flygsand
Last active July 21, 2023 10:36
Show Gist options
  • Save Flygsand/7530825fe5e56035b3591218f0f71503 to your computer and use it in GitHub Desktop.
Save Flygsand/7530825fe5e56035b3591218f0f71503 to your computer and use it in GitHub Desktop.
Tinfoil index for Caddy
{{- $directories := list -}}
{{- $files := list -}}
{{- range .Items -}}
{{- if .IsDir -}}
{{- $directories = mustAppend $directories . -}}
{{- else -}}
{{- $files = mustAppend $files . -}}
{{- end -}}
{{- end -}}
{
"directories": [
{{- range $i, $d := $directories }}
{{- if gt $i 0 -}},{{- end }}
{{ mustToJson $d.URL }}
{{- end }}
],
"files": [
{{- range $i, $f := $files }}
{{- if gt $i 0 -}},{{- end }}
{
"url": {{mustToJson $f.URL}},
"size": {{mustToJson $f.Size}}
}
{{- end}}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment