Closed badonyx closed 6 days ago
I just tested this, and I still the env var respected.
In .env.local I have NEXT_PUBLIC_MAINNET_API_SERVER=https://api.testnet.hiro.so
and I confirmed that the default network is using https://api.testnet.hiro.so
@badonyx Can you provide any further details about what you are doing to use NEXT_PUBLIC_MAINNET_API_SERVER?
It does not work with environment variables from the shell. This always worked before (simplifying a little):
NEXT_PUBLIC_MAINNET_API_SERVER="my://url" pnpm start
The docs do not mention anything about .env.local
. I added this file with my configuration to my repository and after rebuilding it works now.
.env.local is a NextJS feature. It's how NextJS env vars are set and used in the browser. See the docs here - https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables
I also tried setting the env var via the CLI. That worked for me as well.
I ran
NEXT_PUBLIC_MAINNET_API_SERVER="https://api.testnet.hiro.so" pnpm run dev
Explorer no longer respects the environment varaible
NEXT_PUBLIC_MAINNET_API_SERVER
which is supposed to be used to define a custom API server. Now it always overrides my environment variable and uses the builtin defaultapi.hiro.so
.Rolled back to an older version
v1.172.1
and the environment variable is respected again.