debian-forge-composer/cmd/osbuild-composer/config.go
Tom Gundersen 5dac422b9c cmd/composer: drop koji configuration
Now that all interaciton with the koji API happens in the workers
we can drop koji configuration from composer itself. This means
that composer no longer needs to be provisioned with kerberos
credentials, and does not need to know about which koji servers
the workers support.
2020-11-11 18:16:42 +01:00

31 lines
624 B
Go

package main
import (
"io"
"github.com/BurntSushi/toml"
)
type ComposerConfigFile struct {
Koji struct {
AllowedDomains []string `toml:"allowed_domains"`
CA string `toml:"ca"`
} `toml:"koji"`
Worker struct {
AllowedDomains []string `toml:"allowed_domains"`
CA string `toml:"ca"`
} `toml:"worker"`
}
func LoadConfig(name string) (*ComposerConfigFile, error) {
var c ComposerConfigFile
_, err := toml.DecodeFile(name, &c)
if err != nil {
return nil, err
}
return &c, nil
}
func DumpConfig(c *ComposerConfigFile, w io.Writer) error {
return toml.NewEncoder(w).Encode(c)
}