diff --git a/config/config_source.go b/config/config_source.go index a01874672..e2168f877 100644 --- a/config/config_source.go +++ b/config/config_source.go @@ -1,12 +1,9 @@ package config import ( - "reflect" "sync" "github.com/fsnotify/fsnotify" - "github.com/mitchellh/copystructure" - "github.com/spf13/viper" ) // Config holds pomerium configuration options. @@ -14,15 +11,13 @@ type Config struct { Options *Options } -// Clone creates a deep clone of the config. +// Clone creates a clone of the config. func (cfg *Config) Clone() *Config { - return copystructure.Must(copystructure.Config{ - Copiers: map[reflect.Type]copystructure.CopierFunc{ - reflect.TypeOf((*viper.Viper)(nil)): func(i interface{}) (interface{}, error) { - return i, nil - }, - }, - }.Copy(cfg)).(*Config) + newOptions := new(Options) + *newOptions = *cfg.Options + return &Config{ + Options: newOptions, + } } // A ChangeListener is called when configuration changes. diff --git a/go.mod b/go.mod index 05fafd243..365fc1637 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,6 @@ require ( github.com/hashicorp/memberlist v0.2.2 github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect github.com/lithammer/shortuuid/v3 v3.0.4 - github.com/mitchellh/copystructure v1.0.0 github.com/mitchellh/hashstructure v1.0.0 github.com/natefinch/atomic v0.0.0-20200526193002-18c0533a5b09 github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce diff --git a/go.sum b/go.sum index 5ab55ad63..c7cfe8383 100644 --- a/go.sum +++ b/go.sum @@ -342,8 +342,6 @@ github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKju github.com/miekg/dns v1.1.27 h1:aEH/kqUzUxGJ/UHcEKdJY+ugH6WEzsEBBSPa8zuy1aM= github.com/miekg/dns v1.1.27/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= -github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ= -github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= @@ -355,8 +353,6 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/reflectwalk v1.0.0 h1:9D+8oIskB4VJBN5SFlmc27fSlIBZaov1Wpk/IfikLNY= -github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=