Skip to content

chore(config): move non-secret config out of env into code#68

Merged
Adedamola18 merged 10 commits into
mainfrom
chore/env-config-cleanup
Jun 30, 2026
Merged

chore(config): move non-secret config out of env into code#68
Adedamola18 merged 10 commits into
mainfrom
chore/env-config-cleanup

Conversation

@Adedamola18

@Adedamola18 Adedamola18 commented Jun 25, 2026

Copy link
Copy Markdown
Member

Closes https://github.com/IQIndustries/issues/issues/5060 when this PR merged

Move non-secret config out of env into code

  • Move clearly non-sensitive, non-secret values out of environment variables and into the committed config module. Values were verified byte-identical across Vercel production/preview/development.

Moved to code constants:

  • iqAddress (was NEXT_PUBLIC_IQ_ADDRESS)
  • hiiqAddress (was NEXT_PUBLIC_HIIQ_ADDRESS)
  • sophiaAgentAddress (was NEXT_PUBLIC_SOPHIA_AGENT_ADDRESS)
  • iqGatewayUrl (was NEXT_PUBLIC_IQ_GATEWAY_URL)

Removed as dead (declared but never read anywhere in the repo):

  • chainId (NEXT_PUBLIC_CHAIN_ID)
  • alchemyChain (NEXT_PUBLIC_ALCHEMY_CHAIN)
  • walletConnectProjectId (NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID)

Kept in env (intentionally):

  • alchemyApiKey, iqGatewayKey - secrets
  • posthogApiKey - differs between production and preview/dev
  • NEXT_PUBLIC_THEME - runtime seasonal toggle (read in theme.ts)

@vercel

vercel Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
braindao-ui Ready Ready Preview Jun 30, 2026 10:01am

Request Review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/config/index.ts Outdated
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.
Comment thread src/env.ts Outdated
import { createEnv } from "@t3-oss/env-nextjs";
import { z } from "zod";

const isProd = process.env.NEXT_PUBLIC_IS_PROD === "true";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think vercel exposes the env without us defining this

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@Adedamola18
Adedamola18 merged commit 4b55896 into main Jun 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants