-
Notifications
You must be signed in to change notification settings - Fork 593
feat: dashboard UI for environment variables management #4452
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
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThis pull request implements environment variable management with encryption support, replacing dummy data and mocked flows with real TRPC mutations. It introduces bulk import capability, write-only/recoverable type semantics, and secure value encryption via Vault for both create, update, decrypt, and delete operations. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant FE as Frontend<br/>(AddEnvVars)
participant TRPC as TRPC<br/>(create)
participant DB as Database
participant Vault as Vault<br/>(Encryption)
User->>FE: Paste .env content or fill form
FE->>FE: Parse & validate entries<br/>(uppercase keys, uniqueness)
User->>FE: Click Save
FE->>TRPC: POST /create<br/>(envVarId, variables[])
TRPC->>DB: Fetch environment
TRPC->>Vault: Encrypt each value
Vault-->>TRPC: Encrypted values
TRPC->>DB: Insert encrypted variables
DB-->>TRPC: Success
TRPC-->>FE: Success response
FE->>FE: Show toast feedback
FE->>FE: Call onSuccess callback
FE-->>User: Close form, invalidate cache
sequenceDiagram
participant User
participant FE as Frontend<br/>(EnvVarRow)
participant TRPC as TRPC
participant DB as Database
participant Vault as Vault
User->>FE: Click decrypt/reveal button
FE->>TRPC: POST /decrypt<br/>(envVarId)
TRPC->>DB: Fetch var (type check)
alt type === writeonly
TRPC-->>FE: Error FORBIDDEN
else type === recoverable
TRPC->>Vault: Decrypt value
Vault-->>TRPC: Plaintext
end
TRPC-->>FE: Decrypted value
FE->>FE: Display plaintext
FE-->>User: Value revealed
sequenceDiagram
participant User
participant FE as Frontend<br/>(EnvVarForm)
participant TRPC as TRPC<br/>(update)
participant DB as Database
participant Vault as Vault
User->>FE: Edit value/key/type
User->>FE: Click Save
FE->>TRPC: POST /update<br/>(envVarId, key?, value, type)
TRPC->>DB: Fetch existing var
alt type changed or key changed (writeonly)
TRPC-->>FE: Error BAD_REQUEST
else valid update
TRPC->>Vault: Encrypt new value
Vault-->>TRPC: Encrypted value
TRPC->>DB: Update record
DB-->>TRPC: Success
end
TRPC-->>FE: Success/error response
FE->>FE: Toast feedback
FE->>FE: Call onUpdate callback
FE-->>User: Close edit, refresh display
sequenceDiagram
participant User
participant FE as Frontend<br/>(EnvVarRow)
participant TRPC as TRPC<br/>(delete)
participant DB as Database
User->>FE: Click delete button
FE->>FE: Show loading state
FE->>TRPC: POST /delete<br/>(envVarId)
TRPC->>DB: Delete by id & workspace
alt rows affected === 0
TRPC-->>FE: Error NOT_FOUND
else success
DB-->>TRPC: Success
end
TRPC-->>FE: Response
FE->>FE: Toast feedback
FE->>FE: Call onDelete callback
FE-->>User: Row removed, cache invalidated
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Key areas requiring attention:
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (12)
📒 Files selected for processing (19)
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 |
dff1739 to
326ba6e
Compare
326ba6e to
a049700
Compare
7a7836a to
44cc88f
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
4a639b2 to
f14619c
Compare
849b2de to
ac29218
Compare
203e039 to
8d1c219
Compare
* feat: add environment variables db schema and queries * fix db query * feat: add SecretsConfig proto for encrypted env vars * [autofix.ci] apply automated fixes * feat: dashboard UI for environment variables management * fix comment and rename file * fix file export name * Remove unnecessary comments from add-env-vars * add toasts for environment variable operations * [autofix.ci] apply automated fixes * fix: add try/catch error handling to env var mutations * unfmt file * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Andreas Thomas <[email protected]>
* feat: add environment variables db schema and queries * fix db query * feat: add SecretsConfig proto for encrypted env vars * [autofix.ci] apply automated fixes * feat: dashboard UI for environment variables management * fix comment and rename file * fix file export name * Remove unnecessary comments from add-env-vars * add toasts for environment variable operations * [autofix.ci] apply automated fixes * fix: add try/catch error handling to env var mutations * unfmt file * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Andreas Thomas <[email protected]>

What does this PR do?
This hooks up the environment variables UI up to trpc // the db.
Also because i found it annoying as hell to press the
+each time to add a new env var there is an add more button which you can just press directly below the row. Enter on the latest value also adds a new row.Copy pasting a .env file is also support.
Env vars are only decryptable if they are not marked as secret, otherwise you can decrypt them using either
Please ignore the formatting fixes.
Type of change
How should this be tested?
Make sure you can
A. Create a new environment variable either as "secret" or as a normal env var.
B. Decrypt the values of normal env vars
C. NOT Decrypt the values of secret env vars.
D. Edit the value of a secret and normal env var and decrypt normal again and see the correct one.
E. Rename the key of a normal env var and see it change and not being duplicated in any way.
F. Successfully delete a normal env var.
G. Successfully delete a secret env var.
Checklist
Required
pnpm buildpnpm fmtmake fmton/godirectoryconsole.logsgit pull origin mainAppreciated