Skip to content

Migrate to new golang-commons config API #363

@aaronschweig

Description

@aaronschweig

Summary

The github.com/platform-mesh/golang-commons/config package has breaking changes that require updates to this repository.

Breaking Changes

  • NewDefaultConfig() signature changed - no longer returns viper or error
  • BindConfigToFlags() removed - use AddFlags() method instead
  • Environment variables no longer supported as substitutes for flags

Changes Required

Update cmd/root.go to use the new config API:

Before:

v, defaultCfg, err := config.NewDefaultConfig(rootCmd)
if err != nil { ... }
err = config.BindConfigToFlags(v, operatorCmd, &operatorCfg)

After:

defaultCfg := config.NewDefaultConfig()
defaultCfg.AddFlags(cmd.Flags())

Service-specific configuration should be migrated to the same pattern with NewX() constructor and AddFlags() method.

Files to Update

  • cmd/root.go

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions