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

Rename "env" store to "dotenv"

This commit is contained in:
Joost Cassee
2018-10-29 21:50:13 +01:00
parent d45c23c0e3
commit eadef71162
5 changed files with 19 additions and 17 deletions

View File

@@ -12,7 +12,7 @@ import (
"go.mozilla.org/sops/keyservice"
"go.mozilla.org/sops/stores/json"
"go.mozilla.org/sops/stores/yaml"
"go.mozilla.org/sops/stores/env"
"go.mozilla.org/sops/stores/dotenv"
"gopkg.in/urfave/cli.v1"
)
@@ -115,7 +115,7 @@ func DefaultStoreForPath(path string) sops.Store {
} else if IsJSONFile(path) {
return &json.Store{}
} else if IsEnvFile(path) {
return &env.Store{}
return &dotenv.Store{}
}
return &json.BinaryStore{}
}

View File

@@ -36,7 +36,7 @@ import (
"go.mozilla.org/sops/pgp"
"go.mozilla.org/sops/stores/json"
yamlstores "go.mozilla.org/sops/stores/yaml"
"go.mozilla.org/sops/stores/env"
"go.mozilla.org/sops/stores/dotenv"
"gopkg.in/urfave/cli.v1"
)
@@ -334,11 +334,11 @@ func main() {
},
cli.StringFlag{
Name: "input-type",
Usage: "currently json, yaml and binary are supported. If not set, sops will use the file's extension to determine the type",
Usage: "currently json, yaml, dotenv and binary are supported. If not set, sops will use the file's extension to determine the type",
},
cli.StringFlag{
Name: "output-type",
Usage: "currently json, yaml and binary are supported. If not set, sops will use the input file's extension to determine the output format",
Usage: "currently json, yaml, dotenv and binary are supported. If not set, sops will use the input file's extension to determine the output format",
},
cli.BoolFlag{
Name: "show-master-keys, s",
@@ -398,7 +398,8 @@ func main() {
},
cli.StringFlag{
Name: "set",
Usage: `set a specific key or branch in the input JSON or YAML document. value must be a json encoded string. (edit mode only). eg. --set '["somekey"][0] {"somevalue":true}'`,
// FIXME: Warn about complex value types and dotenv files?
Usage: `set a specific key or branch in the input document. value must be a json encoded string. (edit mode only). eg. --set '["somekey"][0] {"somevalue":true}'`,
},
cli.IntFlag{
Name: "shamir-secret-sharing-threshold",
@@ -676,8 +677,8 @@ func inputStore(context *cli.Context, path string) sops.Store {
return &yamlstores.Store{}
case "json":
return &json.Store{}
case "env":
return &env.Store{}
case "dotenv":
return &dotenv.Store{}
case "binary":
return &json.BinaryStore{}
default:
@@ -691,8 +692,8 @@ func outputStore(context *cli.Context, path string) sops.Store {
return &yamlstores.Store{}
case "json":
return &json.Store{}
case "env":
return &env.Store{}
case "dotenv":
return &dotenv.Store{}
case "binary":
return &json.BinaryStore{}
default:

View File

@@ -13,7 +13,7 @@ import (
"go.mozilla.org/sops/aes"
sopsjson "go.mozilla.org/sops/stores/json"
sopsyaml "go.mozilla.org/sops/stores/yaml"
sopsenv "go.mozilla.org/sops/stores/env"
sopsdotenv "go.mozilla.org/sops/stores/dotenv"
)
// File is a wrapper around Data that reads a local encrypted
@@ -29,7 +29,7 @@ func File(path, format string) (cleartext []byte, err error) {
// Data is a helper that takes encrypted data and a format string,
// decrypts the data and returns its cleartext in an []byte.
// The format string can be `json`, `yaml` or `binary`.
// The format string can be `json`, `yaml`, `dotenv` or `binary`.
// If the format string is empty, binary format is assumed.
func Data(data []byte, format string) (cleartext []byte, err error) {
// Initialize a Sops JSON store
@@ -39,8 +39,8 @@ func Data(data []byte, format string) (cleartext []byte, err error) {
store = &sopsjson.Store{}
case "yaml":
store = &sopsyaml.Store{}
case "env":
store = &sopsenv.Store{}
case "dotenv":
store = &sopsdotenv.Store{}
default:
store = &sopsjson.BinaryStore{}
}

View File

@@ -1,4 +1,5 @@
package env //import "go.mozilla.org/sops/stores/env"
package dotenv //import "go.mozilla.org/sops/stores/dotenv"
import (
"bufio"
"bytes"
@@ -10,7 +11,7 @@ import (
"strings"
)
// Store handles storage of env data
// Store handles storage of dotenv data
type Store struct {
}

View File

@@ -1,4 +1,4 @@
package env
package dotenv
import (
"github.com/stretchr/testify/assert"