getdave/grunt-deployments

Saving private information in external file

davidsneighbour opened this issue · 3 comments

It would be useful to have an external file (as done in github.com/zonak/grunt-ftp-deploy) to save private data (password) outside of the gruntfile (and repositories).

Hi .. just my 2c - this can be done today with an external settings json file.

Just below the pkg: grunt.file.readJSON read your external settings file:

settings: grunt.file.readJSON('settings.json'),

And then use those values in your conifg:

       db_dump: {
            local: {
                "options": {
                    "title": '<%= settings.db_name %>',
                    "database": '<%= settings.db_name %>',
                    "user": '<%= settings.db_username %>',
                    "pass": '<%= settings.db_password %>',
                    "host": '<%= settings.db_host %>',
                    "backup_to": 'backups/<%= settings.db_name %>.sql'
                }
            }
        },

The settings.json file should look like this:

{
    "db_name"           : "db_name_here",
    "db_username"       : "db_username",
    "db_password"       : "db_password",
    "db_host"           : "localhost"
}

right, that makes sense. let's close this non-issue then.

Thanks for resolving this guys. I've been away but the technique above it exactly correct.