config.js - App Configuration
In this section, you will learn more about the essential configurations of a Jovo Voice App.
- Adding Configurations
- Accessing Configurations
config.js file in the
src folder of a Jovo project is the place where all configuration of your voice app can be stored.
For example, the
config.js for the "Hello World" Jovo project looks like this:
The above example shows three different elements:
logging: Every request and response will be logged if this is
true. Learn more here.
ENDhandler. Learn more here.
FileDbas database integration. Learn more here.
There are several types of integrations that can be added to the
Below are references to all the general configurations that can be added to the
config.js file. The general configurations are added to the root element of the config object.
|Routing||intentMap||Maps incoming intents to specified intent names|
|intentsToSkipUnhandled||Intents that should not be mapped to 'Unhandled' when not found in a certain state|
|inputMap||Maps incoming input (slots and parameters) to specified input names|
|Data||logging||Logs both requests and responses|
|user||Configure the Jovo User object|
|Output||i18n||Enable multilingual output for your voice app|
Jovo integrations are deeply integrated plugins that ususally implement an interface. Examples are:
db: Database integrations
analytics: Analytics integrations
cms: CMS integrations
Integration configurations are usually structured like this:
Plugin configurations can be added like this:
If you want to access elements from your app config, you can do so by using the following object:
You can also define your own keys and values in the configuration file. For them to not interfere with Jovo config keys, we recommend using a wrapping element like
You can then access them in your app logic with:
Jovo uses a structure similar to
node-config to allow you to add config overrides for different stages.
For example, you could have several config files for different stages:
config.js: Default config of the project
config.qa.js: Config overrides for the QA environment (e.g. DynamoDB)
config.prod.js: Config overrides for the production environment (e.g. DynamoDB + Analytics)
For the app to discover what environment it is currently in, use
STAGE as environment variables.
Here is how the
db parts could differ for different environments:
When using expressJS for deploying your project, you should install the
dotenv library to use staged config files:
and configure it inside your launch Intent:
For project-related staging environments, take a look at project.js.