chore(config): move non-secret config out of env into code#68
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Code Review
This pull request simplifies the configuration in src/config/index.ts by hardcoding several addresses and URLs (such as iqAddress, hiiqAddress, sophiaAgentAddress, and iqGatewayUrl) and removing unused properties like alchemyChain, chainId, and walletConnectProjectId. The reviewer recommends using checksummed (mixed-case) Ethereum addresses for iqAddress and hiiqAddress to prevent potential string comparison bugs with web3 libraries, which return checksummed addresses by default.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Introduce src/env.ts using @t3-oss/env-nextjs to centralize and validate environment access. Non-secret config (IQ/HiIQ/Sophia addresses, IQ gateway URL, public PostHog key) carries in-code defaults that are byte-identical to the deployed Vercel values, so while the Vercel vars stay set they override with the same value (no behavior change) and can later be removed. The PostHog key branches on NEXT_PUBLIC_IS_PROD since it differs between production and preview/development. Genuine secrets (alchemy key, gateway key) have no default and are required from the environment, so a missing value now fails fast at boot instead of silently becoming "undefined".
Point every consumer at the new validated @/env module and delete the unvalidated src/config/index.ts. The config object's dead fields (chainId, alchemyChain, walletConnectProjectId — declared but never read) are dropped in the process. theme.ts is left unchanged: it keeps reading NEXT_PUBLIC_THEME directly so the seasonal theme stays a runtime toggle.
| import { createEnv } from "@t3-oss/env-nextjs"; | ||
| import { z } from "zod"; | ||
|
|
||
| const isProd = process.env.NEXT_PUBLIC_IS_PROD === "true"; |
There was a problem hiding this comment.
i think vercel exposes the env without us defining this
There was a problem hiding this comment.
There was a problem hiding this comment.
i think vercel exposes the env without us defining this
that's correct, I just checked, it defaults to production for NEXT_PUBLIC_VERCEL_ENV. I will update now
…mail link presentation
Closes https://github.com/IQIndustries/issues/issues/5060 when this PR merged
Move non-secret config out of env into code
Moved to code constants:
Removed as dead (declared but never read anywhere in the repo):
Kept in env (intentionally):