# 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;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://quinck.gitbook.io/multijet/configuration/environment-variables.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
