mirror of
https://github.com/Mic92/sops-nix.git
synced 2026-01-12 01:27:54 +08:00
Simplify age logic in sops-install-secrets
This commit is contained in:
parent
0cad90d763
commit
77d0fa5920
1 changed files with 8 additions and 11 deletions
|
|
@ -643,18 +643,15 @@ func installSecrets(args []string) error {
|
|||
defer keyring.Remove()
|
||||
} else if manifest.GnupgHome != "" {
|
||||
os.Setenv("GNUPGHOME", manifest.GnupgHome)
|
||||
} else if manifest.AgeKeyFile != "" || len(manifest.AgeSshKeyPaths) != 0 {
|
||||
if len(manifest.AgeSshKeyPaths) == 0 {
|
||||
os.Setenv("SOPS_AGE_KEY_FILE", manifest.AgeKeyFile)
|
||||
} else {
|
||||
keyfile := filepath.Join(manifest.SecretsMountPoint, "age-keys.txt")
|
||||
err = importAgeSSHKeys(manifest.AgeSshKeyPaths, keyfile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("Wrote keys to %s\n", keyfile)
|
||||
os.Setenv("SOPS_AGE_KEY_FILE", keyfile)
|
||||
} else if len(manifest.AgeSshKeyPaths) != 0 {
|
||||
keyfile := filepath.Join(manifest.SecretsMountPoint, "age-keys.txt")
|
||||
err = importAgeSSHKeys(manifest.AgeSshKeyPaths, keyfile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
os.Setenv("SOPS_AGE_KEY_FILE", keyfile)
|
||||
} else if manifest.AgeKeyFile != "" {
|
||||
os.Setenv("SOPS_AGE_KEY_FILE", manifest.AgeKeyFile)
|
||||
}
|
||||
|
||||
if err := decryptSecrets(manifest.Secrets); err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue