osbuild-composer: use less pointers in config

The default values of fields in both ComposerConfig.Koji and
ComposerConfig.Worker are well-suited for how they're used.

The nil-checks in main.go only checked that the sections exist. This is
quite a weak check for validity, because the sections could be empty. If
anything is required for composer to function, we could add proper
validation in the future.

Do the same for the CA fields, which contain file names. Go has lots of
precedent for using empty strings to denote "no value" in the standard
library. Use it for CA files, too, instead of pointers.
This commit is contained in:
Lars Karlitski 2020-09-25 11:20:09 +02:00 committed by Tom Gundersen
parent db9bf1c659
commit 13d5129b56
4 changed files with 45 additions and 18 deletions

11
cmd/osbuild-composer/testdata/test.toml vendored Normal file
View file

@ -0,0 +1,11 @@
[koji]
allowed_domains = [ "osbuild.org" ]
ca = "/etc/osbuild-composer/ca-crt.pem"
[koji.servers."example.com".kerberos]
principal = "example@osbuild.org"
keytab = "/etc/osbuild-composer/osbuild.keytab"
[worker]
allowed_domains = [ "osbuild.org" ]
ca = "/etc/osbuild-composer/ca-crt.pem"