Find the rigth way to configure BD constas in config.json file

16 views
Skip to first unread message

Lissette compartia

unread,
Feb 2, 2016, 4:41:01 AM2/2/16
to Open Badges Dev Group
Hi!

I'm lissette, i've been working to implement the badgeKit (web and API), in my localhost (Mac). The principal problem that I have it's in the enviorments file. 
First I tried to use the 
source    my_name_file_env

but doesn't work in my OS,  i was searching and I find this instruccion

bash  my_name_file_env

This instruccion  could run without problems, but my connection was refuse, that means my env variables couldn't work, for that I did something wrong, I went to the mysqlConnection file for the mysqlmodule, and I put the values direct in the variables.

Then I found a link in this group about to use a config.json file instead off an .env file,  (https://groups.google.com/forum/#!searchin/openbadges-dev/config$20/openbadges-dev/3ZOH5-LbTvA/qacjhk1xIUgJ)
 
Looking for others post in the group, the config.file in the badgekit use the module config-store, and now i feel confuse, becuase, I don't know in what part I integrate the variables 

Config.json file it's lik this 

const path = require('path');
const config = require('config-store');


try {

 exports = module.exports = config(path.join(__dirname, '../../config.json'));

 alert(exports);

} catch (e) {

 exports = module.exports = config();

}


I try in this way


const path = require('path');


//const config = require('config-store');


const configStore = require('config-store');


const config = (


                {


                    "COOKIE_SECRET": "compartia",


                    "PORT": "3000",


                    "OPENBADGER_SYSTEM": "badgekit",


                    "OPENBADGER_URL": "http://localhost:8080",


                    "OPENBADGER_SECRET": "compartiabadge",


                    "DATABASE_DRIVER": "mysql",


                    "DATABASE_HOST": "localhost",


                    "DATABASE_USER": "root",


                    "DATABASE_PASSWORD": "root",


                    "DATABASE_DATABASE": "badgekit",


                    "PERSONA_AUDIENCE": "http://localhost:3000",


                    "API_SECRET": "jj54a590432qjj",


                    "BRANDING": "abc",


                    "ACCESS_LIST": ["^d...@compartia.net$"]


                }


);


               




try {


  exports = module.exports = configStore(path.join(__dirname, '../../config.json'));


  alert(exports);


} catch (e) {


  exports = module.exports = configStore();


}


I'm new in node.js and their structure so I know I need help, and any advice, 

thanks

Compartia


Reply all
Reply to author
Forward
0 new messages