# How to propagate the env

**URL:** <https://community.doppler.com/t/how-to-propagate-the-env/1478>\
**Category:** Need Help\
**Created:** [March 1, 2024, 8:43pm UTC](https://community.doppler.com/t/how-to-propagate-the-env/1478 "2024-03-01T20:43:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Itelo\_Filho](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/itelo_filho/32/1025_2.png) [@Itelo\_Filho](https://community.doppler.com/u/Itelo_Filho)\
**Post date:** [March 1, 2024, 8:43pm UTC](https://community.doppler.com/t/how-to-propagate-the-env/1478/1 "2024-03-01T20:43:46Z")

</div>

I am facing some issues with having only one doppler env for two of my Next.js projects. Next.js has some env variables that cannot be repeated, such as `PORT`. My solution was to add `<PREFIX_>PORT` and then removing it later in a script. The solution is working but it’s a bit of hack and ugly

```bash
# bash.sh

while read -r line; do
    if [[$line == PREFIX_*]]; then
        original_var_name=${line%%=*}
        value=${line#*=}
        new_var_name=${original_var_name#STUDENT_APP_}
        unset "$new_var_name"
        export "$new_var_name"="$value"
        unset "$original_var_name"
    fi
done < <(env)

pnpm run next dev

```

my package.json is something like:

```json
{
  "next": "next",
  "dev": "doppler run --preserve-env -p DOPPLER_PROJECT -c dev --command=\"./bash.sh\"",
}

```

is there a way to improve this? how can I move the `pnpm run next dev` from the end of the file to the package.json script, so it’ll be more reusable?

---

<div class="post-metadata">

**Author:** ![watsonian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/watsonian/32/267_2.png) [@watsonian](https://community.doppler.com/u/watsonian)\
**Post date:** [March 1, 2024, 9:10pm UTC](https://community.doppler.com/t/how-to-propagate-the-env/1478/2 "2024-03-01T21:10:36Z")

</div>

@Itelo_Filho Could you elaborate a bit on why you need two separate `PORT` secrets in a single config? Typically, this is exactly what a [branch config](https://docs.doppler.com/docs/branch-configs) would be for. Is there a reason that won’t work for your scenario?

---

<div class="post-metadata">

**Author:** ![Itelo\_Filho](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/itelo_filho/32/1025_2.png) [@Itelo\_Filho](https://community.doppler.com/u/Itelo_Filho)\
**Post date:** [March 1, 2024, 9:13pm UTC](https://community.doppler.com/t/how-to-propagate-the-env/1478/3 "2024-03-01T21:13:57Z")

</div>

I’m build a whitelabel, I want to have everything in one branch config, so it’ll easier to track.

dev-whitelabel (the one I use now)  
dev-company-1, a branch where I change variable like database\_url etc  
dev-company-2  
…

---

<div class="post-metadata">

**Author:** ![watsonian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.doppler.com/watsonian/32/267_2.png) [@watsonian](https://community.doppler.com/u/watsonian)\
**Post date:** [March 1, 2024, 9:57pm UTC](https://community.doppler.com/t/how-to-propagate-the-env/1478/4 "2024-03-01T21:57:26Z")

</div>

@Itelo_Filho Doppler actually isn’t designed for patterns like that (essentially using us as a datastore). For example, you’re limited to 10 configs per environment on the Developer plan (100 on the Team plan), so that pattern won’t scale at all. Configs are meant to be for things like different deployment environments. So, you might have `prd_aws`, `prd_gcp` and `prd_azure` for example. It’s not meant to be something that scales 1:1 with resources that can grow unbounded in your application. In terms of doing this on a secret level inside a config, that won’t really work either since there’s a 1000 secret limit per config.

I would recommend using a secure datastore to store the information about your customer environments and then use Doppler to store the credentials your application will use to fetch that data.
