config.md
config loading fixtures๐
Each case pairs a config.yaml input with the result of loading it:
either the normalized repo listing, or the startup error.
Paths are shown with the config file's directory as $BASE.
Regenerate the result hunks with go test -run TestLoadConfig . -testmark.regen.
Good configs๐
The minimal config: one repo, and the % placeholder saying its path matches its name.
repos:
parnass:
path: "%"
repo parnass: path=$BASE/parnass
Names may be slash-nested to arbitrary depth; paths may be relative (resolved against the config file's directory, even pointing outside it) or absolute; descriptions are optional.
repos:
parnass:
path: "%"
description: "the showcase repo"
work/infra/deploy:
path: ../deploy
elsewhere:
path: /srv/git/elsewhere
repo elsewhere: path=/srv/git/elsewhere
repo parnass: path=$BASE/parnass description="the showcase repo"
repo work/infra/deploy: path=$PARENT/deploy
Trailing slashes on paths are normalized away.
repos:
tidy:
path: "sub/dir/"
repo tidy: path=$BASE/sub/dir
Bad configs๐
Every problem below is a startup error: socle refuses to run on a config it can't fully honor.
Unknown keys are errors, not silence; typos should not quietly change meaning.
repos:
parnass:
path: "%"
exposed: true
error: config $BASE/config.yaml: yaml: unmarshal errors:
line 4: field exposed not found in type main.repoConfig
A config with nothing to serve is a misconfiguration.
repos: {}
error: config $BASE/config.yaml: no repos configured; a socle with nothing on display is a misconfiguration
Repo names are validated: segments of [A-Za-z0-9._-], no leading dot or dash.
repos:
.hidden:
path: "%"
error: config $BASE/config.yaml: invalid: repo name ".hidden": segment ".hidden" starts with "."
Names ending in .git are rejected: URLs treat a trailing .git as an alias
for the plain name, and configuring one would make that alias ambiguous.
repos:
parnass.git:
path: "%"
error: config $BASE/config.yaml: invalid: repo name "parnass.git": segment "parnass.git" ends in .git (reserved as a URL alias for the plain name)
No repo name may be a path-prefix of another; nested names would make URL dispatch ambiguous.
repos:
work:
path: "%"
work/deploy:
path: "%"
error: config $BASE/config.yaml: repo "work" is a path-prefix of repo "work/deploy"; nested names would make URL dispatch ambiguous
The path field is required; an empty entry is probably an accident, so there is no default.
repos:
parnass:
description: "all description, no substance"
error: config $BASE/config.yaml: repo "parnass": missing required field "path" (use "path: %" to serve the path matching the repo name)
Serving the filesystem root is refused outright.
repos:
everything:
path: "/"
error: config $BASE/config.yaml: repo "everything": path "/" is the filesystem root; refusing
testdata/config.md ยท 3.9 KiB ยท ef8eddc0ca