summaryrefslogtreecommitdiffstats
path: root/output
diff options
context:
space:
mode:
Diffstat (limited to 'output')
-rw-r--r--output/config.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/output/config.go b/output/config.go
index 7b83ef9de..86e5bcfaa 100644
--- a/output/config.go
+++ b/output/config.go
@@ -32,6 +32,11 @@ type OutputFormatConfig struct {
Format
}
+var defaultOutputFormat = Format{
+ BaseName: "index",
+ Rel: "alternate",
+}
+
func DecodeConfig(mediaTypes media.Types, in any) (*config.ConfigNamespace[map[string]OutputFormatConfig, Formats], error) {
buildConfig := func(in any) (Formats, any, error) {
f := make(Formats, len(DefaultFormats))
@@ -59,20 +64,12 @@ func DecodeConfig(mediaTypes media.Types, in any) (*config.ConfigNamespace[map[s
continue
}
- var newOutFormat Format
+ newOutFormat := defaultOutputFormat
newOutFormat.Name = k
if err := decode(mediaTypes, v, &newOutFormat); err != nil {
return f, nil, err
}
- // We need values for these
- if newOutFormat.BaseName == "" {
- newOutFormat.BaseName = "index"
- }
- if newOutFormat.Rel == "" {
- newOutFormat.Rel = "alternate"
- }
-
f = append(f, newOutFormat)
}