8000 fix: database cred helper: crash if encryption config file is missing by g-linville · Pull Request #455 · obot-platform/tools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: database cred helper: crash if encryption config file is missing #455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 21, 2025
Merged
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
8 changes: 7 additions & 1 deletion credential-stores/pkg/common/encryption.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import (

func readEncryptionConfig(ctx context.Context) (*encryptionconfig.EncryptionConfiguration, error) {
encryptionConfigPath := os.Getenv("GPTSCRIPT_ENCRYPTION_CONFIG_FILE")
var useDefault bool
if encryptionConfigPath == "" {
useDefault = true
var err error
if encryptionConfigPath, err = xdg.ConfigFile("gptscript/encryptionconfig.yaml"); err != nil {
return nil, fmt.Errorf("failed to read encryption config from standard location: %w", err)
Expand All @@ -22,7 +24,11 @@ func readEncryptionConfig(ctx context.Context) (*encryptionconfig.EncryptionConf

if _, err := os.Stat(encryptionConfigPath); err != nil {
if os.IsNotExist(err) {
return nil, nil
if useDefault {
fmt.Println("WARNING: credentials will be stored unencrypted")
return nil, nil
}
return nil, fmt.Errorf("encryption config file does not exist: %w", err)
}
return nil, fmt.Errorf("failed to stat encryption config file: %w", err)
}
Expand Down
Loading
0