1
0
mirror of https://github.com/getsops/sops.git synced 2026-02-05 12:45:21 +01:00

Allow no indent at all for json store

Signed-off-by: Bastien Wermeille <bastien.wermeille@gmail.com>
This commit is contained in:
Bastien Wermeille
2023-09-14 20:41:56 +02:00
parent c6dc5267e5
commit 755c16d49c
5 changed files with 64 additions and 7 deletions

View File

@@ -149,6 +149,12 @@ type creationRule struct {
MACOnlyEncrypted bool `yaml:"mac_only_encrypted"`
}
func NewStoresConfig() *StoresConfig{
storesConfig := &StoresConfig{}
storesConfig.JSON.Indent = -1
return storesConfig
}
// Load loads a sops config file into a temporary struct
func (f *configFile) load(bytes []byte) error {
err := yaml.Unmarshal(bytes, f)
@@ -252,6 +258,7 @@ func loadConfigFile(confPath string) (*configFile, error) {
return nil, fmt.Errorf("could not read config file: %s", err)
}
conf := &configFile{}
conf.Stores = *NewStoresConfig()
err = conf.load(confBytes)
if err != nil {
return nil, fmt.Errorf("error loading config: %s", err)