Configuration

Introduction

EJS environments 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.

contexts

No

An object defining environmental contexts and their prerequisite conditions.

Example

environment.js
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
                }
            ]
        }
    ]
};

Last updated