Skip to content

Manifests and Configurations

Johan Hernandez edited this page Nov 24, 2011 · 5 revisions

Application Manifests

A fire.js Manifest, usually called ignition manifest, is a JSON file that will provide configurations for the runtime and third-party modules.

When an application is executed using firejs, the command line utility, it will look for a file called ignition.manifest.json` in the same directory where the main file resides.

Ignitable Modules

node.js Modules specially designed to expose expressions to the Runtime (also known as ignitables) are required to be added to the manifest if the expressions will be used by the program.

The following Example Manifest will tell the Runtime to load a third party module called superExpressions:

{
	"modules": [
		"superExpressions"
	]
}

All the expressions exposed by the superExpressions ignitable will be now available to be used from your program or module.

Configurations

Environment are a set of configurations or requirements for each stage of the product, like "development", "staging", "production" and fire.js follows the standard node.js environment variable NODE_ENV to load the desired environment accordingly. The default environment is "development".

Manifest can contain configurations for each environment as follows:

{
	"modules": [
		"expressionModule1",
		"expressionModule2"
	],
	"environments": {
		"production": {
			"expressionModule1": {
				"config1": "config value for expressionModule1",
				"config2": 200
			},
			"expressionModule2": {
				"config1": "value2",
				"config2": 200
			}
		}
	}
}

Module Manifests

Ignitable Modules can have it's own ignition manifest, it can be used to provide default values for the module on different environments or declare ignitable dependencies. When the runtime loads the module, the module manifest will be merged into the main manifest.

The merging process follows some simple rules:

  • If the value is not in the main manifest yet, the value from the module manifest will be set.
  • If the value already exists in the main manifest, the value from the module will be ignored as it's been considered overridden.

Environment Values

All the manifest can use environment variables of the process by wrapping the keys between double brackets:

{
	"UserLog": "{{HOME}}/log.txt"
}

Default values can also be specified if the key is followed by the pipe symbol |:

{
	"UserLog": "{{ILIKETHEMOON|No moon tonight}}/log.txt"
}

In the last case "UserLog" would be set as "No moon tonight/log.txt" since 'ILIKETHEMOON' will not be found in process.env nor as a special environment variable.

Special Environment Variables

There are some special environment variables that don't really exists in process.env but they are interpreted so:

  • FIRE_APP_NAME: The name of the application. Taken from runtime.applicationName.
  • FIRE_ENV_NAME: The name of the runtime environment. Taken from runtime.environmentName.
  • FIRE_APP_PID: Taken from process.pid.

Thanks for Reading. Please take your time to read other tutorials.

Contributors

If you find any error in this tutorial(misspelling errors, syntax errors, etc) please send me an email with your corrections, I'll be more than happy to add you in this list.