I just began working with mysql in node.js and I am setting up my app.js project and I am trying to hide my connection details such as my ip, username, pw, and db name. I don't know how to go about hiding my connection details, so this is why i'm here.
I have tried to add the details in my .profile
, but I keep getting an authentication error. But, when I include these same connection details in my regular app.js file, it works and connects to the database.
Here is what is being displayed in my app.js file:
var connection = mysql.createConnection({
host : 'my.ip.address.info',
user : 'username',
password : 'password',
database : 'databaseName'
});
console.log('Connected');
connection.connect();
I just want to hide my connection details so that when my site goes live in the future it is secured from prying eyes. I understand that leaving these connection details in my app.js file is not the correct thing to do, so that's why I'm asking for help!