Set configuration settings in config.example.js

Added database connection in a global variable and a reusable configuration method.