Open darioghilardi opened 10 years ago
I suggest something like https://github.com/bkeepers/dotenv
I am using generator-yeogurt
(and trying to embed grunt-wordpress-deploy
into) and it uses .ftppass
to provide all credentials for grunt-ftpush
.
You can load external JSON data (that not tracked by Git) for templates to make your build system sensible for connection credentials and security purposes with grunt.file.readJSON()
:
gruntfile.js
grunt.config.set('deploy',grunt.file.readJSON('deploy.json'));
grunt.initConfig({
// or just:
// deploy: grunt.file.readJSON('deploy.json'),
wordpressdeploy: {
…
staging:{
title:'staging',
database:'<%=deploy.staging.database.name%>',
user:'<%=deploy.staging.database.username%>',
pass:'<%=deploy.staging.database.password%>',
…
},
…
deploy.json
{
"staging": {
"ssh" : {
"user" : "staging SSH user",
"host" : "staging SSH host"
},
"database" : {
"name" : "staging DB name",
"username" : "staging DB user",
"password" : "staging DB password",
"host" : "staging DB host"
},
"url" : "http://domain.zone/",
"path" : "remote/path/"
},
…
}
But it will be awesome to map this data into built-in-plugin module that looking for deploy.json
or something similar by default so you haven't do it manually. So we can have few options as we can with all possible defaults to run quickly.
Sensible data, like database username and password, should be written in a different file than the Gruntfile. This way you can add to version control the Gruntfile without any privacy problem.