Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ License URL: https://gitea.com/gitea/go-sdk/src/tag/gitea/v0.25.1/gitea/LICENSE
Module: dario.cat/mergo
Version: v1.0.2
License: BSD-3-Clause
License URL: Unknown
License URL: https://github.com/imdario/mergo/blob/v1.0.2/LICENSE

----------
Module: filippo.io/age
Expand Down
6 changes: 2 additions & 4 deletions internal/installer/config_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ codesphere:
Expect(string(rendered)).To(ContainSubstring(`apiToken: "super-secret-token"`))
})

It("rejects unencrypted prod.vault.yaml files", func() {
It("supports unencrypted prod.vault.yaml files", func() {
tempDir := GinkgoT().TempDir()
vaultPath := filepath.Join(tempDir, "prod.vault.yaml")

Expand All @@ -120,8 +120,6 @@ codesphere:

_, err = installer.LoadVaultData(vaultPath, "")

Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("is not SOPS-encrypted"))
Expect(err).ToNot(HaveOccurred())
})

})
14 changes: 7 additions & 7 deletions internal/installer/vault_templating_secret_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,16 @@ func LoadVaultData(vaultPath, ageKeyPath string) (*files.InstallVault, error) {
if err != nil {
return nil, fmt.Errorf("failed to inspect vault file %s: %w", vaultPath, err)
}
if !encrypted {
return nil, fmt.Errorf("vault file %s is not SOPS-encrypted", vaultPath)
}

decrypted, err := DecryptFileWithSOPS(vaultPath, ageKeyPath)
if err != nil {
return nil, fmt.Errorf("failed to decrypt vault.yaml: %w", err)
if encrypted {
decrypted, err := DecryptFileWithSOPS(vaultPath, ageKeyPath)
if err != nil {
return nil, fmt.Errorf("failed to decrypt vault.yaml: %w", err)
}
data = decrypted
}

vault, err := parseVaultData(decrypted)
vault, err := parseVaultData(data)
if err != nil {
return nil, fmt.Errorf("failed to parse decrypted vault.yaml: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/tmpl/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ License URL: https://gitea.com/gitea/go-sdk/src/tag/gitea/v0.25.1/gitea/LICENSE
Module: dario.cat/mergo
Version: v1.0.2
License: BSD-3-Clause
License URL: Unknown
License URL: https://github.com/imdario/mergo/blob/v1.0.2/LICENSE

----------
Module: filippo.io/age
Expand Down
Loading