lockbox

password manager
Log | Files | Refs | README | LICENSE

commit 8b9038cdab232b7ff143b106f5fb57d9605a85d7
parent 2bbcc32dd270057c052f7673d98a3e29a34db93d
Author: Sean Enck <sean@ttypty.com>
Date:   Sat, 29 Jul 2023 11:40:11 -0400

shorten this option name

Diffstat:
Minternal/backend/query_test.go | 6+++---
Minternal/config/vars.go | 2+-
Minternal/config/vars_test.go | 10+++++-----
Mtests/run.sh | 10+++++-----
4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/internal/backend/query_test.go b/internal/backend/query_test.go @@ -97,7 +97,7 @@ func TestValueModes(t *testing.T) { if len(m.ModTime) < 20 { t.Errorf("invalid date/time") } - os.Setenv("LOCKBOX_JSON_DATA_OUTPUT_HASH_LENGTH", "10") + os.Setenv("LOCKBOX_JSON_DATA_HASH_LENGTH", "10") defer os.Clearenv() q, err = fullSetup(t, true).Get("test/test/abc", backend.JSONValue) if err != nil { @@ -128,7 +128,7 @@ func TestValueModes(t *testing.T) { if len(m.ModTime) < 20 || m.Data == "" { t.Errorf("invalid json: %v", m) } - os.Setenv("LOCKBOX_JSON_DATA_OUTPUT", "plAINtExt") + os.Setenv("LOCKBOX_JSON_DATA", "plAINtExt") defer os.Clearenv() q, err = fullSetup(t, true).Get("test/test/abc", backend.JSONValue) if err != nil { @@ -141,7 +141,7 @@ func TestValueModes(t *testing.T) { if len(m.ModTime) < 20 || m.Data != "tedst" { t.Errorf("invalid json: %v", m) } - os.Setenv("LOCKBOX_JSON_DATA_OUTPUT", "emPTY") + os.Setenv("LOCKBOX_JSON_DATA", "emPTY") defer os.Clearenv() q, err = fullSetup(t, true).Get("test/test/abc", backend.JSONValue) if err != nil { diff --git a/internal/config/vars.go b/internal/config/vars.go @@ -75,7 +75,7 @@ var ( // EnvModTime is modtime override ability for entries EnvModTime = EnvironmentString{environmentBase: environmentBase{key: prefixKey + "SET_MODTIME", desc: fmt.Sprintf("Input modification time to set for the entry\n(expected format: %s).", ModTimeFormat)}, canDefault: true, defaultValue: "", allowed: []string{"modtime"}} // EnvJSONDataOutput controls how JSON is output in the 'data' field - EnvJSONDataOutput = EnvironmentString{environmentBase: environmentBase{key: prefixKey + "JSON_DATA_OUTPUT", desc: fmt.Sprintf("Changes what the data field in JSON outputs will contain use\n'%s' with CAUTION.", JSONDataOutputRaw)}, canDefault: true, defaultValue: string(JSONDataOutputHash), allowed: []string{string(JSONDataOutputRaw), string(JSONDataOutputHash), string(JSONDataOutputBlank)}} + EnvJSONDataOutput = EnvironmentString{environmentBase: environmentBase{key: prefixKey + "JSON_DATA", desc: fmt.Sprintf("Changes what the data field in JSON outputs will contain use\n'%s' with CAUTION.", JSONDataOutputRaw)}, canDefault: true, defaultValue: string(JSONDataOutputHash), allowed: []string{string(JSONDataOutputRaw), string(JSONDataOutputHash), string(JSONDataOutputBlank)}} // EnvFormatTOTP supports formatting the TOTP tokens for generation of tokens EnvFormatTOTP = EnvironmentFormatter{environmentBase: environmentBase{key: EnvTOTPToken.key + "_FORMAT", desc: "Override the otpauth url used to store totp tokens. It must have ONE format\nstring ('%s') to insert the totp base code."}, fxn: formatterTOTP, allowed: "otpauth//url/%s/args..."} // EnvConfig is the location of the config file to read environment variables from diff --git a/internal/config/vars_test.go b/internal/config/vars_test.go @@ -173,22 +173,22 @@ func TestParseJSONMode(t *testing.T) { if m != config.JSONDataOutputHash || err != nil { t.Error("invalid mode read") } - os.Setenv("LOCKBOX_JSON_DATA_OUTPUT", "hAsH ") + os.Setenv("LOCKBOX_JSON_DATA", "hAsH ") m, err = config.ParseJSONOutput() if m != config.JSONDataOutputHash || err != nil { t.Error("invalid mode read") } - os.Setenv("LOCKBOX_JSON_DATA_OUTPUT", "EMPTY") + os.Setenv("LOCKBOX_JSON_DATA", "EMPTY") m, err = config.ParseJSONOutput() if m != config.JSONDataOutputBlank || err != nil { t.Error("invalid mode read") } - os.Setenv("LOCKBOX_JSON_DATA_OUTPUT", " PLAINtext ") + os.Setenv("LOCKBOX_JSON_DATA", " PLAINtext ") m, err = config.ParseJSONOutput() if m != config.JSONDataOutputRaw || err != nil { t.Error("invalid mode read") } - os.Setenv("LOCKBOX_JSON_DATA_OUTPUT", "a") + os.Setenv("LOCKBOX_JSON_DATA", "a") if _, err = config.ParseJSONOutput(); err == nil || err.Error() != "invalid JSON output mode: a" { t.Errorf("invalid error: %v", err) } @@ -199,7 +199,7 @@ func TestClipboardMax(t *testing.T) { } func TestHashLength(t *testing.T) { - checkInt(config.EnvHashLength, "LOCKBOX_JSON_DATA_OUTPUT_HASH_LENGTH", "hash length", 0, true, t) + checkInt(config.EnvHashLength, "LOCKBOX_JSON_DATA_HASH_LENGTH", "hash length", 0, true, t) } func TestMaxTOTP(t *testing.T) { diff --git a/tests/run.sh b/tests/run.sh @@ -14,7 +14,7 @@ _execute() { export LOCKBOX_INTERACTIVE=no export LOCKBOX_READONLY=no export LOCKBOX_KEYMODE=plaintext - export LOCKBOX_JSON_DATA_OUTPUT_HASH_LENGTH=0 + export LOCKBOX_JSON_DATA_HASH_LENGTH=0 echo test2 |${LB_BINARY} insert keys/k/one2 echo test |${LB_BINARY} insert keys/k/one echo test |${LB_BINARY} insert key/a/one @@ -140,12 +140,12 @@ _rekey() { echo ${LB_BINARY} ls ${LB_BINARY} show keys/k/one2 - export LOCKBOX_JSON_DATA_OUTPUT=plaintext + export LOCKBOX_JSON_DATA=plaintext ${LB_BINARY} json k - export LOCKBOX_JSON_DATA_OUTPUT=empty + export LOCKBOX_JSON_DATA=empty ${LB_BINARY} json k - export LOCKBOX_JSON_DATA_OUTPUT=hash - export LOCKBOX_JSON_DATA_OUTPUT_HASH_LENGTH=3 + export LOCKBOX_JSON_DATA=hash + export LOCKBOX_JSON_DATA_HASH_LENGTH=3 ${LB_BINARY} json k }