Skip to content

Navigation Menu

Sign up
firebaseco edited this page Oct 21, 2011 · 2 revisions

Every application or module may require to execute an expression to initialize a part of the app according to the environment.

Initializers can be created in two ways:

By using initializers Directory

initializers is an optional directory for your application or priest module that will hold expressions to be executed by certain environment. Every folder inside corresponds to the target environment.

Examples:

  1. initializers/development will contain all the development expressions activated in development environment, this is the default environment but it can be enforced by using NODE_ENV=development.

  2. initializers/test will contain all the testing expressions activated in test environment when using NODE_ENV=test.

What the runtime does with the expressions of the current initializer directory is decorate them with the 'initialize' attribute when they are loaded.

By using the initialize attribute.

You can also specify which expressions are used to initialize the environment by using the initialize attribute in your expressions without including the expression in any initializer directory. The attribute will accept an array with all the environment names in which the expression it should be executed.

Example, the following expression will be used as a initializer for "development" and "staging":

{
 "name": "MyApp.Dev.Init",
 "initialize": ["development", "staging"],
 "json": {}
}

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /