Skip to content

VBM Configuration

Klervi edited this page Oct 15, 2019 · 6 revisions


The framework configuration

In our framework, the file framework/conf/node-red-config.js is a copy of Node-RED's settings.js to manage custom configuration.

We have modified it so that it would accept environmental variables and also so that it would load additional conf information in each project's conf/config.js file.


The project configuration

Each project has a conf/config.js file which contains environment-related configuration information.

Content

Authorized Users

Among other things, this file defines the credentials that will grant you access to the bot editing interface. The admin.users array contains for each user object:

{
    username: "demo", 
    password: "password hash", 
    permissions: "*"
}

Server configuration

The server object contains the following fields:

{
    host: "https://yourHostUrl", 
    path: "/someAdditionalPathIfNeeded",
    verbose: false,
    key: "VISEObotMakerKey"
}

Hash your passwords

You MUST update the password defined in conf/config.js. First, in VBM/framework, create a new password with the command lines:

npm install bcryptjs
node -e "console.log(require('bcryptjs').hashSync(process.argv[1], 8));" your-password-here

Copy the resulting hash. Then, edit the VIM/bots/projects/mybot/conf/config.js. Search for the following lines, change the username and paste the password:


"admin": {
    users: [{
        username: "demo",
        password: "new password hash", 
        permissions: "*"
    }]
}

Get a VISEO Bot Maker Key

Using the framework requires a valid key, which you can get for free here. The aim for us is to be able to know which versions of the framework are installed, and which packages are most used in order to better prioritize our maintenance efforts.

The usage of this key is not mandatory, you can run the service without having it but we would appreciate that you use it to help us improve our project.

The key is actually used by our most relevant nodes only (servers/connectors, messages, NLP, computer vision, etc.). Data is collected when the input event is triggered. Each day, the following object is sent to our servers:

{
   "info": {
       "start": /* timestamp: first collected data */,
       "end":   /* timestamp: last collected data */,
       "key":   /* VISEO Bot KEY */
   },
   "data": [{
       "type":  /* node type */,
       "start": /* timestamp: first collected data for this node type */,
       "end":   /* timestamp: last collected data for this node type */,
       "nodes": /* number of nodes for this type */,
       "calls": /* number of calls */
   }, ...]
}

Define each of your environments

In the empty provided project, the configuration is set for the config.dev environment. You will need to define similar configurations for each environment you will need.

In the same file, you can also change the server.host value to match your bot url, and the server.verbose boolean to log messages in the console (default is true, but you may want to disable it in production).

config.dev = {
    "admin": { ... },
    "server": { 
        "host": "https://your.dev.host/",
        "path": "/bot1",
        "verbose": true,
        "key": "devKey"
    }
};
config.prod = {
    "admin": { ... },
    "server": { 
        "host": "https://your.prod.bot/",
        "verbose": false,
        "key": "prodKey"
    }
};