-
Notifications
You must be signed in to change notification settings - Fork 253
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
chore: move ApiKey type to backends, remove AccountTier sqlx::Type #1923
base: main
Are you sure you want to change the base?
Conversation
jonaro00
commented
Nov 26, 2024
- debloats common
- prevents mistake of binding an AccountTier and db not finding the type
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.
PR Summary
This PR moves the ApiKey type from common to backends module and removes AccountTier's sqlx::Type derivation to reduce common module bloat and prevent database type binding issues.
- Relocated ApiKey implementation to
backends/src/key.rs
with proper validation for 16-char alphanumeric keys and secure memory handling via zeroize - Removed
#[cfg_attr(feature = "persist", derive(sqlx::Type))]
fromcommon/src/models/user.rs
to prevent direct AccountTier database bindings - Updated import paths across codebase to use
shuttle_backends::key::ApiKey
instead of from common module
11 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile
let mut errors = vec![]; | ||
if !key.chars().all(char::is_alphanumeric) { | ||
errors.push("The API key should consist of only alphanumeric characters."); | ||
}; |
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.
syntax: unnecessary semicolon after if block creates unreachable code
@@ -68,12 +67,8 @@ extract_propagation = [ | |||
"tracing-opentelemetry", | |||
] | |||
models = ["async-trait", "reqwest", "service"] |
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.
style: models feature still depends on service feature but service feature depends on display - consider flattening these dependencies to avoid circular references
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.
See auth CI failure