# vue-cli-service environment variables

> How to access environment variables in VueJs. Basically all variables are pulled in if they are prefixed with `VUE_APP_`. Here's how.

- URL: https://graffino.com/til/vue-cli-service-environment-variables
- Author: Nick Ciolpan
- Channel: vue
- Published: 2020-12-14
- Updated: 2021-11-04

While you can find detailed information in the official docs, I dare to spoil the fun for you: 

### 1. All app variables are pulled in if they are prefixed with ```VUE_APP_```. 
Example: ```VUE_APP_API_URL```.

You can now access the variables in your application like this: ```process.env.APP_URL```.

### 2. All e2e variables are fetched if they are prefixed with```CYPRESS_```. 
Example: ```CYPRESS_APP_URL```. 

You can now access the variables in your tests like this: ```Cypress.env('APP_URL')```.
