# Configuration

## Introduction

EJS [environments](/ejs/1.4/guide/environments.md) are configured using a standard `environment.js` configuration file. This file must reside in the root directory of a given EJS environment.

## Directives

Each `environment.js` file may include the following directives:

| Directive         | Required | Description                                                                                                                                                                                                         |
| ----------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name              | Yes      | The name of the application in a format appropriate to display to users.                                                                                                                                            |
| version           | Yes      | The version of the application.                                                                                                                                                                                     |
| apiPath           | Yes      | A path to prefix to API requests.                                                                                                                                                                                   |
| layoutNamespace   | Yes      | A namespace for layout components, relative to the environment root.                                                                                                                                                |
| moduleNamespace   | Yes      | A namespace for modules, relative to the environment root.                                                                                                                                                          |
| pluginNamespace   | Yes      | A namespace for plugins, relative to the environment root.                                                                                                                                                          |
| registeredModules | Yes      | An array of modules to be enabled. The module name must match its directory name in the moduleNamespace.  ***NOT YET IMPLEMENTED:** The pathPrefix is prepended to all route paths defined by this module.*         |
| plugins           | No       | An array of classnames of plugins to be installed, relative to the pluginNamespace.  The file extension is not required.                                                                                            |
| flags             | No       | An object containing key-value pairs which provide additional configuration settings, such as enabling [missing translation warnings](/ejs/1.4/guide/internationalization/locales.md#missing-translation-warnings). |
| contexts          | No       | An object defining [environmental contexts](broken://pages/-LKwIfiEAdmR7rkmQkPv) and their prerequisite [conditions](broken://pages/-LKwLLeMKE4WZNGvLKSv).                                                          |

## Example

{% code title="environment.js" %}

```javascript
module.exports = {
    name: 'My Application',
    version: '1.0',
    apiPath: '/path/to/api',
    layoutNamespace: 'Layout',
    moduleNamespace: 'Module',
    pluginNamespace: 'Plugin',
    registeredModules: [
        {
            name: 'MyModule',
            pathPrefix: '/mymodule'
        },
        {
            name: 'Sandbox',
            pathPrefix: '/sandbox'
        }
    ],
    plugins: [
        'Vue/Directive/i18nDirective',
        'Vue/InstanceMethod/Api',
        'Vue/InstanceMethod/FindRouteByName',
        'Vue/InstanceMethod/GeneratePath',
        'Vue/InstanceMethod/GetRoute',
        'Vue/InstanceMethod/RedirectTo',
        'Vue/InstanceMethod/SetLocale',
        'Vue/InstanceMethod/Translate'
    ],
    flags: {
        'i18n-warnings': false
    },
    contexts: [
        {
            id: 'undergrad',
            conditions: [
                {
                    key: 'orgId',
                    value: 1
                }
            ]
        },
        {
            id: 'postgrad',
            conditions: [
                {
                    key: 'orgId',
                    value: 2
                }
            ]
        }
    ]
};
```

{% endcode %}


---

# 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://docs.elentra.org/ejs/1.4/guide/environments/configuration.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.
