зеркало из https://github.com/getsops/sops.git
Add indentation settings for json_binary
Signed-off-by: Bastien <bastien.wermeille@gmail.com>
This commit is contained in:
Родитель
8a63bb0d21
Коммит
42018ef4a5
|
@ -1162,8 +1162,8 @@ When operating on stdin, use the ``--input-type`` and ``--output-type`` flags as
|
|||
|
||||
$ cat myfile.json | sops --input-type json --output-type json -d /dev/stdin
|
||||
|
||||
JSON indentation
|
||||
~~~~~~~~~~~~~~~~
|
||||
JSON and JSON_binary indentation
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
SOPS indents ``JSON`` files by default using one ``tab``. However, you can change
|
||||
this default behaviour to use ``spaces`` by either using the additional ``--indent=2`` CLI option or
|
||||
|
@ -1176,6 +1176,8 @@ The special value ``0`` disables indentation, and ``-1`` uses a single tab.
|
|||
stores:
|
||||
json:
|
||||
indent: 2
|
||||
json_binary:
|
||||
indent: 2
|
||||
|
||||
YAML indentation
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
|
|
@ -1091,6 +1091,7 @@ func outputStore(context *cli.Context, path string) common.Store {
|
|||
indent := context.Int("indent")
|
||||
storesConf.YAML.Indent = indent
|
||||
storesConf.JSON.Indent = indent
|
||||
storesConf.JSONBinary.Indent = indent
|
||||
}
|
||||
|
||||
return common.DefaultStoreForPathOrFormat(storesConf, path, context.String("output-type"))
|
||||
|
|
|
@ -67,11 +67,13 @@ type DotenvStoreConfig struct{}
|
|||
|
||||
type INIStoreConfig struct{}
|
||||
|
||||
type JSONStoreConfig struct{
|
||||
type JSONStoreConfig struct {
|
||||
Indent int `yaml:"indent"`
|
||||
}
|
||||
|
||||
type JSONBinaryStoreConfig struct{}
|
||||
type JSONBinaryStoreConfig struct {
|
||||
Indent int `yaml:"indent"`
|
||||
}
|
||||
|
||||
type YAMLStoreConfig struct {
|
||||
Indent int `yaml:"indent"`
|
||||
|
@ -149,9 +151,10 @@ type creationRule struct {
|
|||
MACOnlyEncrypted bool `yaml:"mac_only_encrypted"`
|
||||
}
|
||||
|
||||
func NewStoresConfig() *StoresConfig{
|
||||
storesConfig := &StoresConfig{}
|
||||
func NewStoresConfig() *StoresConfig {
|
||||
storesConfig := &StoresConfig{}
|
||||
storesConfig.JSON.Indent = -1
|
||||
storesConfig.JSONBinary.Indent = -1
|
||||
return storesConfig
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,9 @@ type BinaryStore struct {
|
|||
}
|
||||
|
||||
func NewBinaryStore(c *config.JSONBinaryStoreConfig) *BinaryStore {
|
||||
return &BinaryStore{config: *c}
|
||||
return &BinaryStore{config: *c, store: *NewStore(&config.JSONStoreConfig{
|
||||
Indent: c.Indent,
|
||||
})}
|
||||
}
|
||||
|
||||
// LoadEncryptedFile loads an encrypted json file onto a sops.Tree object
|
||||
|
|
Загрузка…
Ссылка в новой задаче