diff --git a/cmd/sops/common/common.go b/cmd/sops/common/common.go index 03d6f340a..4960e6e47 100644 --- a/cmd/sops/common/common.go +++ b/cmd/sops/common/common.go @@ -30,15 +30,10 @@ type ExampleFileEmitter interface { EmitExample() []byte } -type Configurable interface { - Configure(*config.Config) -} - // Store handles marshaling and unmarshaling from SOPS files type Store interface { sops.Store ExampleFileEmitter - Configurable } type storeConstructor = func(*config.StoresConfig) Store diff --git a/cmd/sops/main.go b/cmd/sops/main.go index 3cdc7e933..96ae2477a 100644 --- a/cmd/sops/main.go +++ b/cmd/sops/main.go @@ -706,7 +706,7 @@ func main() { }, cli.IntFlag{ Name: "indent", - Usage: "the number of space to indent yaml encoded file for encryption", + Usage: "the number of space to indent YAML encoded file for encryption", }, cli.BoolFlag{ Name: "verbose", @@ -1069,7 +1069,7 @@ func keyservices(c *cli.Context) (svcs []keyservice.KeyServiceClient) { return } -func inputStore(context *cli.Context, path string) common.Store { +func loadStoresConfig(context *cli.Context, path string) (*config.StoresConfig, error) { var configPath string if context.String("config") != "" { configPath = context.String("config") @@ -1077,20 +1077,16 @@ func inputStore(context *cli.Context, path string) common.Store { // Ignore config not found errors returned from FindConfigFile since the config file is not mandatory configPath, _ = config.FindConfigFile(".") } - storesConf, _ := config.LoadStoresConfig(configPath) + return config.LoadStoresConfig(configPath) +} +func inputStore(context *cli.Context, path string) common.Store { + storesConf, _ := loadStoresConfig(context, path) return common.DefaultStoreForPathOrFormat(storesConf, path, context.String("input-type")) } func outputStore(context *cli.Context, path string) common.Store { - var configPath string - if context.String("config") != "" { - configPath = context.String("config") - } else { - // Ignore config not found errors returned from FindConfigFile since the config file is not mandatory - configPath, _ = config.FindConfigFile(".") - } - storesConf, _ := config.LoadStoresConfig(configPath) + storesConf, _ := loadStoresConfig(context, path) if context.Int("indent") != 0 { storesConf.YAML.Indent = context.Int("indent") } diff --git a/stores/dotenv/store.go b/stores/dotenv/store.go index e930d3960..db895fcd9 100644 --- a/stores/dotenv/store.go +++ b/stores/dotenv/store.go @@ -202,6 +202,3 @@ func isComplexValue(v interface{}) bool { } return false } - -func (store *Store) Configure(c *config.Config) { -} diff --git a/stores/ini/store.go b/stores/ini/store.go index b74705e11..d703d87cf 100644 --- a/stores/ini/store.go +++ b/stores/ini/store.go @@ -288,6 +288,3 @@ func (store *Store) EmitExample() []byte { } return bytes } - -func (store *Store) Configure(c *config.Config) { -} diff --git a/stores/json/store.go b/stores/json/store.go index bcd8bdba9..5b56236ed 100644 --- a/stores/json/store.go +++ b/stores/json/store.go @@ -348,9 +348,3 @@ func (store *Store) EmitExample() []byte { } return bytes } - -func (store *Store) Configure(c *config.Config) { -} - -func (store *BinaryStore) Configure(c *config.Config) { -} diff --git a/stores/yaml/store.go b/stores/yaml/store.go index 50850bb10..701f7edc5 100644 --- a/stores/yaml/store.go +++ b/stores/yaml/store.go @@ -407,6 +407,3 @@ func (store *Store) EmitExample() []byte { } return bytes } - -func (store *Store) Configure(c *config.Config) { -}