Configuration - NGRP/node-red-viseo-bot GitHub Wiki
Versioning
There are several reasons why you would want to version your project. It enables you to keep track of the history of your flow and nodes, it acts as a backup and it will facilitate publishing actions.
We currently use a Git server but you could use any other type of versioning system.
cd pathtomybot
git init
git remote add origin [email protected]:yourrepository.git
The command line above assumes you have ssh access to the git server "gitserver.com" with the username "user" (On GitHub, it would be [email protected]:myaccount/myrepository.git).
You should set git to ignore automatically generated/downloaded files. Create the .gitignore file and insert the following lines:
node_modules
data/.*
data/*.db
data/*.log
Now you can add your files to your repository and push to the server.
git add .
git commit -m "Initial commit"
git push -u origin master
Environment based configuration
You might want your configurations to adapt to the environment your project runs under. For example if you use NLP nodes, you would want all your NLP nodes to use the same NLP configuration but this configuration should be different from DEV to PROD to avoid conflicts between versions.
To handle that we take advantage of the credentials feature of Node-RED. Credentials are loaded in their own file (not flows.json) and the VISEO Bot Maker choses this file depending on the NODE_ENV environment variable.
Let's say you have run your project under dev and prod, you should find in your data directory:
- flows_cred_dev.json
- flows_cred_prod.json
Any new environment you would want to run your project under, a new empty file will be created for credentials and you will need to write it through the Node-RED web interface.
Node that these credentials will be encrypted using your credential secret and we advise you to use a different secret for each environment
Please read the documentation for credentials in Node-RED for further explanation about credentials specificities.