Web build environment

Hi team! How are you?

I’m struggling with web configuration. Currently, in my project, I have a file with an API URL that changes based on the release channel and if development is enabled. For example:

if (__DEV__) {
    return DEV_API;
}
if (releaseChannel == 'staging') {
    return STAGING_API;
}
return PRODUCTION_API;

The issue I’m having is that the web build does not have a release channel, so when I deploy to staging it always uses PRODUCTION_API.

Is there a way, using expo build:web to set the release channel or an environment variable?

Thanks in advance!

Edit: Also, I’m using this for metrics, so using ‘(empty string)’ as URL so navigator resolves it couldn’t work :frowning:

Solved using environment variables in configuration

//app.config.ts
{
    extra: {
        web: process.env.RELEASE_CHANNEL
    }
}

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.