Skip to content

Commit

Permalink
use config.NewConfigFromToml to get sane defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
tempoz committed Aug 12, 2024
1 parent 1bd979b commit 15935fa
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions cmd/soci-store/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import (
"github.com/awslabs/soci-snapshotter/store"
"github.com/awslabs/soci-snapshotter/ztoc"
"github.com/containerd/containerd/log"
"github.com/pelletier/go-toml"

sddaemon "github.com/coreos/go-systemd/v22/daemon"
"github.com/hashicorp/go-multierror"
Expand Down Expand Up @@ -110,13 +109,11 @@ func main() {

// Get configuration from specified file
if *configPath != "" {
tree, err := toml.LoadFile(*configPath)
if err != nil && !(os.IsNotExist(err) && *configPath == defaultConfigPath) {
log.G(ctx).WithError(err).Fatalf("failed to load config file %q", *configPath)
}
if err := tree.Unmarshal(&serviceCfg); err != nil {
log.G(ctx).WithError(err).Fatalf("failed to unmarshal config file %q", *configPath)
cfg, err := config.NewConfigFromToml(*configPath)
if err != nil {
log.G(ctx).WithError(err).Fatal(err)
}
serviceCfg = cfg.ServiceConfig
}

// Prepare kubeconfig-based keychain if required
Expand Down

0 comments on commit 15935fa

Please sign in to comment.