From c9abb66637e3eebb37e8b5747b4342fdc9945801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Mon, 21 Sep 2020 12:16:46 +0200 Subject: [PATCH] osbuild-composer/config: rework the structure Prior this change, the structure was following: [koji.localhost.kerberos] This change modifies it to: [koji.servers.localhost.kerberos] This allows us to put more config options under the koji section. See following commits, they use this new possibility. --- cmd/osbuild-composer/main.go | 17 +++++++++++------ test/image-tests/osbuild-composer.toml | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/cmd/osbuild-composer/main.go b/cmd/osbuild-composer/main.go index 7ad25d9b3..79fc5db0e 100644 --- a/cmd/osbuild-composer/main.go +++ b/cmd/osbuild-composer/main.go @@ -72,11 +72,13 @@ func createTLSConfig(c *connectionConfig) (*tls.Config, error) { func main() { var config struct { - KojiServers map[string]struct { - Kerberos *struct { - Principal string `toml:"principal"` - KeyTab string `toml:"keytab"` - } `toml:"kerberos,omitempty"` + Koji *struct { + Servers map[string]struct { + Kerberos *struct { + Principal string `toml:"principal"` + KeyTab string `toml:"keytab"` + } `toml:"kerberos,omitempty"` + } `toml:"servers"` } `toml:"koji"` Worker *struct { AllowedDomains []string `toml:"allowed_domains"` @@ -190,8 +192,11 @@ func main() { // Optionally run Koji API if kojiListeners, exists := listeners["osbuild-composer-koji.socket"]; exists { + if config.Koji == nil { + log.Fatal("koji not configured in the config file") + } kojiServers := make(map[string]koji.GSSAPICredentials) - for server, creds := range config.KojiServers { + for server, creds := range config.Koji.Servers { if creds.Kerberos == nil { // For now we only support Kerberos authentication. continue diff --git a/test/image-tests/osbuild-composer.toml b/test/image-tests/osbuild-composer.toml index 7a6a4932b..c1172b0bd 100644 --- a/test/image-tests/osbuild-composer.toml +++ b/test/image-tests/osbuild-composer.toml @@ -1,4 +1,4 @@ -[koji.localhost.kerberos] +[koji.servers.localhost.kerberos] principal = "osbuild-krb@LOCAL" keytab = "/etc/osbuild-composer/client.keytab"