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.
This commit is contained in:
Ondřej Budai 2020-09-21 12:16:46 +02:00 committed by Tom Gundersen
parent 9a26d077db
commit c9abb66637
2 changed files with 12 additions and 7 deletions

View file

@ -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

View file

@ -1,4 +1,4 @@
[koji.localhost.kerberos]
[koji.servers.localhost.kerberos]
principal = "osbuild-krb@LOCAL"
keytab = "/etc/osbuild-composer/client.keytab"