@@ -10,6 +10,7 @@ import (
1010 "github.com/getsops/sops/v3"
1111 "github.com/getsops/sops/v3/cmd/sops/codes"
1212 . "github.com/getsops/sops/v3/cmd/sops/formats"
13+ "github.com/getsops/sops/v3/config"
1314 "github.com/getsops/sops/v3/keys"
1415 "github.com/getsops/sops/v3/keyservice"
1516 "github.com/getsops/sops/v3/kms"
@@ -35,26 +36,26 @@ type Store interface {
3536 ExampleFileEmitter
3637}
3738
38- type storeConstructor = func () Store
39+ type storeConstructor = func (* config. StoresConfig ) Store
3940
40- func newBinaryStore () Store {
41- return & json.BinaryStore {}
41+ func newBinaryStore (c * config. StoresConfig ) Store {
42+ return json .NewBinaryStore ( & c . JSONBinary )
4243}
4344
44- func newDotenvStore () Store {
45- return & dotenv.Store {}
45+ func newDotenvStore (c * config. StoresConfig ) Store {
46+ return dotenv .NewStore ( & c . Dotenv )
4647}
4748
48- func newIniStore () Store {
49- return & ini.Store {}
49+ func newIniStore (c * config. StoresConfig ) Store {
50+ return ini .NewStore ( & c . INI )
5051}
5152
52- func newJsonStore () Store {
53- return & json.Store {}
53+ func newJsonStore (c * config. StoresConfig ) Store {
54+ return json .NewStore ( & c . JSON )
5455}
5556
56- func newYamlStore () Store {
57- return & yaml.Store {}
57+ func newYamlStore (c * config. StoresConfig ) Store {
58+ return yaml .NewStore ( & c . YAML )
5859}
5960
6061var storeConstructors = map [Format ]storeConstructor {
@@ -153,27 +154,27 @@ func NewExitError(i interface{}, exitCode int) *cli.ExitError {
153154
154155// StoreForFormat returns the correct format-specific implementation
155156// of the Store interface given the format.
156- func StoreForFormat (format Format ) Store {
157+ func StoreForFormat (format Format , c * config. StoresConfig ) Store {
157158 storeConst , found := storeConstructors [format ]
158159 if ! found {
159160 storeConst = storeConstructors [Binary ] // default
160161 }
161- return storeConst ()
162+ return storeConst (c )
162163}
163164
164165// DefaultStoreForPath returns the correct format-specific implementation
165166// of the Store interface given the path to a file
166- func DefaultStoreForPath (path string ) Store {
167+ func DefaultStoreForPath (c * config. StoresConfig , path string ) Store {
167168 format := FormatForPath (path )
168- return StoreForFormat (format )
169+ return StoreForFormat (format , c )
169170}
170171
171172// DefaultStoreForPathOrFormat returns the correct format-specific implementation
172173// of the Store interface given the formatString if specified, or the path to a file.
173174// This is to support the cli, where both are provided.
174- func DefaultStoreForPathOrFormat (path , format string ) Store {
175+ func DefaultStoreForPathOrFormat (c * config. StoresConfig , path string , format string ) Store {
175176 formatFmt := FormatForPathOrString (path , format )
176- return StoreForFormat (formatFmt )
177+ return StoreForFormat (formatFmt , c )
177178}
178179
179180// KMS_ENC_CTX_BUG_FIXED_VERSION represents the SOPS version in which the
0 commit comments