Skip to content

Different env var value for different deploy previews #8

@JuanFdS

Description

@JuanFdS

Hi!,
I'm just starting to use netlify and found your plugin while trying to setup different env vars for different environments, great work btw 👏

One thing I wanted to do is having an env var, which we are using to set the backend url, that would be used only by one deploy preview, so then I could point different deploy previews to different backends (because the backend is deployed from a pull request too).

What I got from reading this plugin's code and trying out some things is that the DEPLOY_PREVIEW prefix sets the env var for all deploy previews, right?

I thought that using the branch prefix would make it possible and then ran into the problem that the BRANCH env var on deploy previews is a reference to the PR, not to the branch itself, so in my case it looks something like pull/2/head and / isn't an allowed character in netlify's UI to set nev vars.

Is there any other way I'm missing? (without using branch deploys instead of deploy previews)

I guess one way to support this would be to have the name of the branch transformed to replace / by _ the same way -s are being replaced before replacing the env vars. What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions