-
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]>
* 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 * feat: decrypt env vars in CTRL workflow before passing to Krane * feat: inject env vars into pod spec via Krane * feat: add customer-workload service account for pod isolation * remove gw from k8s manifest, add agent fix ctrl vault for certs * seperate master keys too * add inital webhook stuff * add generated stuff * adjust comments * use otel lgtm stack in k8s too * fix some rabbit comments * fix some rabbit comments * get rid of some unncessary comments * actually add unkey env cmd gitignores... * fix golint issues * Fix/update validation issues status label (#4478) * fix: update API key status label from 'Potential issues' to 'High Error Rate' Changed the validation-issues status label to more clearly communicate that the key is receiving invalid requests, rather than implying the API or key itself is broken. Changes: - Label: 'Potential issues' → 'High Error Rate' - Tooltip: Updated to clarify that requests are invalid (rate limited, unauthorized, etc.) rather than suggesting system issues Fixes #4474 * chore: apply biome formatting * fix: update status label to 'Elevated Rejections' per review --------- Co-authored-by: CodeReaper <[email protected]> * chore: Remove un-used UI components (#4472) * removed un used components * updated members refs --------- Co-authored-by: James P <[email protected]> Co-authored-by: Andreas Thomas <[email protected]> * perf: fix n+1 (#4484) * fix: add 403 error when 0 key verification perms (#4483) * fix: add 403 error when 0 key verification perms * cleanup tests * feat: add environment variables db schema and queries (#4450) * feat: add environment variables db schema and queries * fix db query * feat: add SecretsConfig proto for encrypted env vars (#4451) * feat: add environment variables db schema and queries * fix db query * feat: add SecretsConfig proto for encrypted env vars * [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 GetPullToken * feat: dashboard UI for environment variables management (#4452) * 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: decrypt env vars in CTRL workflow before passing to Krane (#4453) * 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 * feat: decrypt env vars in CTRL workflow before passing to Krane --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Andreas Thomas <[email protected]> * feat: inject env vars into pod spec via Krane (#4454) * 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 * feat: decrypt env vars in CTRL workflow before passing to Krane * feat: inject env vars into pod spec via Krane --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Andreas Thomas <[email protected]> * feat: add customer-workload service account for pod isolation (#4455) * 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 * feat: decrypt env vars in CTRL workflow before passing to Krane * feat: inject env vars into pod spec via Krane * feat: add customer-workload service account for pod isolation --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Andreas Thomas <[email protected]> * remove gw from k8s manifest, add agent fix ctrl vault for certs (#4463) * 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 * feat: decrypt env vars in CTRL workflow before passing to Krane * feat: inject env vars into pod spec via Krane * feat: add customer-workload service account for pod isolation * remove gw from k8s manifest, add agent fix ctrl vault for certs * seperate master keys too --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Andreas Thomas <[email protected]> * chore: Make Stripe Great Again (#4479) * fix: Make stripe webhooks more robust * chore: Move alert to UI (#4485) * Moved alert to ui and swapped usages * feat: better env var injection (#4468) * 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 * feat: decrypt env vars in CTRL workflow before passing to Krane * feat: inject env vars into pod spec via Krane * feat: add customer-workload service account for pod isolation * remove gw from k8s manifest, add agent fix ctrl vault for certs * seperate master keys too * add inital webhook stuff * add generated stuff * adjust comments * use otel lgtm stack in k8s too * fix some rabbit comments * fix some rabbit comments * get rid of some unncessary comments * actually add unkey env cmd gitignores... * fix golint issues (#4477) * [autofix.ci] apply automated fixes * fix fmt * linter be happy --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Andreas Thomas <[email protected]> * make token pod owned * feat: add lets encrypt challenges (#4471) * feat: add lets encrypt challenges * always disable cname following * cleanup some code * cleanup some code * cleanup some code * cleanup some code * cleanup some code * fix golint issues * fix golint issues * fmt * remove old webhook code * remove old webhook code * make build id not optiona * cleanup * cleanup * fmt * fmt --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: abhay <[email protected]> Co-authored-by: CodeReaper <[email protected]> Co-authored-by: James P <[email protected]> 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