diff --git a/cmd/sops/common/common.go b/cmd/sops/common/common.go index b4dac243a..629de5fe2 100644 --- a/cmd/sops/common/common.go +++ b/cmd/sops/common/common.go @@ -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{} } diff --git a/cmd/sops/main.go b/cmd/sops/main.go index 45b91dbf4..ed5a41024 100644 --- a/cmd/sops/main.go +++ b/cmd/sops/main.go @@ -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: diff --git a/decrypt/decrypt.go b/decrypt/decrypt.go index a85b4b2bb..3351459f5 100644 --- a/decrypt/decrypt.go +++ b/decrypt/decrypt.go @@ -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{} } diff --git a/stores/env/store.go b/stores/dotenv/store.go similarity index 96% rename from stores/env/store.go rename to stores/dotenv/store.go index 4b594b8ff..387164970 100644 --- a/stores/env/store.go +++ b/stores/dotenv/store.go @@ -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 { } diff --git a/stores/env/store_test.go b/stores/dotenv/store_test.go similarity index 98% rename from stores/env/store_test.go rename to stores/dotenv/store_test.go index 198445003..fef18a0e1 100644 --- a/stores/env/store_test.go +++ b/stores/dotenv/store_test.go @@ -1,4 +1,4 @@ -package env +package dotenv import ( "github.com/stretchr/testify/assert"