-
Notifications
You must be signed in to change notification settings - Fork 1
Initializers
Every application or module may require to execute an expression to initialize a part of the app according to the current environment.
Initializers can be created in two ways: By using initializers Directory or the initialize attribute.
initializers is an optional directory for your application or fire.js module that will contain expressions to be executed automatically for specific environments. Every folder inside corresponds to the target environment.
Examples:
-
initializers/developmentwill contain all the development expressions activated indevelopmentenvironment, this is the default environment but it can be enforced by using NODE_ENV=development. -
initializers/testwill contain all the testing expressions activated intestenvironment when using NODE_ENV=test.
All the expressions of those directories will be decorated with the 'initialize' attribute when they are exported to the runtime.
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 will act as a initializer.
Example, the following expression will be used as a initializer for "development" and "staging":
{
"name": "MyApp.Dev.Init",
"initialize": ["development", "staging"],
"json": {}
}