-
Couldn't load subscription status.
- Fork 3
Update: Adding default value to API Key env vars #335
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
base: master
Are you sure you want to change the base?
Conversation
WalkthroughCentralizes encryption key resolution into a new helper in BaseAPIKeyManager, updates encrypt/decrypt to use it, and adds tests ensuring errors when the key is unset. Test project settings now provide explicit defaults for related env vars. The .env file adds a comment clarifying a dummy key is for local development. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant Manager as BaseAPIKeyManager
participant Helper as _get_encryption_key
participant Settings as Django settings/env
rect rgb(245,245,255)
Client->>Manager: encrypt(data, encryption_key=None)
Manager->>Helper: resolve key
Helper->>Settings: read BA_API_KEY_ENCRYPTION_KEY (or use provided)
alt key unset
Helper-->>Manager: raise ValueError("BA_API_KEY_ENCRYPTION_KEY is not set")
Manager-->>Client: exception
else key present
Helper-->>Manager: return key
Manager-->>Client: ciphertext
end
end
note over Manager,Helper: decrypt(...) and rotate_encryption_key(...) follow the same key resolution path
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a ImproperlyConfigured exception would be more appropriate
Addressing critical issue that is blocking the staging environment from running
Other PRs:
Summary by CodeRabbit