> For the complete documentation index, see [llms.txt](https://quinck.gitbook.io/multijet/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://quinck.gitbook.io/multijet/configuration/environment-variables.md).

# Environment variables

Multijet offers environment variable validation for microservices using `Joi`.

To add an environment variable to a microservice, simply edit the `env.ts` file located in `<service-name>/src/utils/env.ts`:

{% code title="env.ts" %}

```typescript
import Joi from 'joi'

// add variable and corresponding type here
export type Environment = {
    ENVIRONMENT: string
}

// add validation rule for the variables defined above
export const JoiEnvironmentValidationSchema = Joi.object<Environment>()
    .keys({
        ENVIRONMENT: Joi.string().required(),
    })
    .required()
    .unknown()
```

{% endcode %}

If you want to run your project locally using AWS Lambda or Docker, you can **specify the environment variables** in the global `.env` file located in `<project-name>/.env` (the file is ignored by default for security reasons, if it does not exists you can simply create it).

Example of a simple `.env` file containing one variable called `environment`:

{% code title=".env" %}

```bash
ENVIRONMENT=dev
```

{% endcode %}

{% hint style="info" %}
All the variables specified in this file will be assigned to every microservice.
{% endhint %}

With this, running your project locally will assign every environment variables needed by your microservices.&#x20;
