vinyl-ftp
vinyl-ftp copied to clipboard
Hide ftp credentials
Hi,
Is there a way that I can have the ftp credentials in a separate file and read them in my gulp deploy function for vinyl-ftp and put that file in my .gitignore so I don't expose my ftp credentials when I do git-push.
Try https://www.npmjs.com/package/dotenv , I've used it myself and worked like a charm.
When I tried something similar, I created a file called ftp.json and filed credentials for host user and password and saved it on the root of my project, same location as my gulpfile.js and on the top section of my gulp I insert the following:
var ftp_cred = require('ftp.json’) and set up the rest of the vinyl-ftp task in my gulpfile.js and run gulp deploy I get the error, Error: Cannot find module 'ftp.json'
12 jan. 2018 kl. 01:07 skrev KrakerCoke [email protected]:
Yikes,
file.json { "port": 21, "host:" 127.0.0.1 }
Javascript let ftp = require('file.json');
ftp.port / ftp.host in javascript to access the values, and just add the file to .gitignore?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/morris/vinyl-ftp/issues/105#issuecomment-357102621, or mute the thread https://github.com/notifications/unsubscribe-auth/AGyTLBLHmF8btYiTvVkHoq5rdSt2JLDPks5tJqJGgaJpZM4RaXMF.
let fpt_cred = require('./ftp.json'); notice the ./ as without is recognized as a module.
aha, thanks..that worked out. My process is after making some code changes, and running my gulp build where alt the content is sent to a dist folder. Then I run the gulp deploy where all changes in my dist folder are supposed to be processed. But the only thing that happens is that the command line is showing:
CONN
CONN
and then nothing, it seems to time out after a while. And no changes are visible on the actual site.
I get the same respons even though I try to insert the credentials directly in the gulp file too.