# Aurelia 2: pass build-time variables (dot env?) to browser

**URL:** <https://discourse.aurelia.io/t/aurelia-2-pass-build-time-variables-dot-env-to-browser/5312>\
**Category:** Help Requests\
**Created:** [December 5, 2023, 3:41pm UTC](https://discourse.aurelia.io/t/aurelia-2-pass-build-time-variables-dot-env-to-browser/5312 "2023-12-05T15:41:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![migajek](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/migajek/32/379_2.png) [@migajek](https://discourse.aurelia.io/u/migajek)\
**Post date:** [December 5, 2023, 3:41pm UTC](https://discourse.aurelia.io/t/aurelia-2-pass-build-time-variables-dot-env-to-browser/5312/1 "2023-12-05T15:41:07Z")

</div>

Hi,  
I need to register the http api service in the container, however - depending on the environment, a different backend URL should be used.

Aurelia 1 used to have environment files with a webpack loader (if I recall correctly) so it was possible to access environment-specific values in the browser app.

What is the approach in Au2? The stub app includes webpack dotenv plugin, but to my understanding it is intended for compile-time only?

---

<div class="post-metadata">

**Author:** ![ivan](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/ivan/32/2022_2.png) [@ivan](https://discourse.aurelia.io/u/ivan)\
**Post date:** [December 6, 2023, 11:47am UTC](https://discourse.aurelia.io/t/aurelia-2-pass-build-time-variables-dot-env-to-browser/5312/2 "2023-12-06T11:47:41Z")

</div>

I just use it like this:

`.env` and `.env.development` both have something like this in them:

```auto
API_BASE_URL=...

```

then in my code I use it like this: `process.env.API_BASE_URL`

Works for dev mode and production builds.
