Skip to content

Commit be5cff1

Browse files
committed
Rename SopsAgeSshPrivateKeyEnv to SopsAgeSshPrivateKeyFileEnv
Signed-off-by: haoqixu <hq.xu0o0@gmail.com>
1 parent d76e5e0 commit be5cff1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

age/keysource.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ const (
2626
// SopsAgeKeyFileEnv can be set as an environment variable pointing to an
2727
// age keys file.
2828
SopsAgeKeyFileEnv = "SOPS_AGE_KEY_FILE"
29-
// SopsAgeSshPrivateKeyEnv can be set as an environment variable pointing to
29+
// SopsAgeSshPrivateKeyFileEnv can be set as an environment variable pointing to
3030
// a private SSH key file.
31-
SopsAgeSshPrivateKeyEnv = "SOPS_AGE_SSH_PRIVATE_KEY"
31+
SopsAgeSshPrivateKeyFileEnv = "SOPS_AGE_SSH_PRIVATE_KEY_FILE"
3232
// SopsAgeKeyUserConfigPath is the default age keys file path in
3333
// getUserConfigDir().
3434
SopsAgeKeyUserConfigPath = "sops/age/keys.txt"
@@ -306,7 +306,7 @@ func parseSSHIdentityFromPrivateKeyFile(keyPath string) (age.Identity, error) {
306306
// environment variable is not present, it will fall back to `~/.ssh/id_ed25519`
307307
// or `~/.ssh/id_rsa`. If no age SSH identity is found, it will return nil.
308308
func loadAgeSSHIdentity() (age.Identity, error) {
309-
sshKeyFilePath, ok := os.LookupEnv(SopsAgeSshPrivateKeyEnv)
309+
sshKeyFilePath, ok := os.LookupEnv(SopsAgeSshPrivateKeyFileEnv)
310310
if ok {
311311
return parseSSHIdentityFromPrivateKeyFile(sshKeyFilePath)
312312
}

age/keysource_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ func TestMasterKey_Decrypt(t *testing.T) {
261261

262262
assert.NoError(t, os.MkdirAll(filepath.Dir(keyPath), 0o700))
263263
assert.NoError(t, os.WriteFile(keyPath, []byte(mockSshIdentity), 0o644))
264-
t.Setenv(SopsAgeSshPrivateKeyEnv, keyPath)
264+
t.Setenv(SopsAgeSshPrivateKeyFileEnv, keyPath)
265265

266266
got, err := key.Decrypt()
267267
assert.NoError(t, err)
@@ -407,7 +407,7 @@ func TestMasterKey_loadIdentities(t *testing.T) {
407407
assert.Len(t, got, 1)
408408
})
409409

410-
t.Run(SopsAgeSshPrivateKeyEnv, func(t *testing.T) {
410+
t.Run(SopsAgeSshPrivateKeyFileEnv, func(t *testing.T) {
411411
tmpDir := t.TempDir()
412412
overwriteUserConfigDir(t, tmpDir)
413413

@@ -418,7 +418,7 @@ func TestMasterKey_loadIdentities(t *testing.T) {
418418

419419
assert.NoError(t, os.MkdirAll(filepath.Dir(keyPath), 0o700))
420420
assert.NoError(t, os.WriteFile(keyPath, []byte(mockSshIdentity), 0o644))
421-
t.Setenv(SopsAgeSshPrivateKeyEnv, keyPath)
421+
t.Setenv(SopsAgeSshPrivateKeyFileEnv, keyPath)
422422

423423
key := &MasterKey{}
424424
got, err := key.loadIdentities()

0 commit comments

Comments
 (0)