Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move sensible data outside of the Gruntfile. #2

Open
darioghilardi opened this issue Nov 23, 2013 · 3 comments
Open

Move sensible data outside of the Gruntfile. #2

darioghilardi opened this issue Nov 23, 2013 · 3 comments

Comments

@darioghilardi
Copy link
Member

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.

@razielgn
Copy link

I suggest something like https://github.com/bkeepers/dotenv

@Grawl
Copy link

Grawl commented Nov 17, 2014

I am using generator-yeogurt (and trying to embed grunt-wordpress-deploy into) and it uses .ftppass to provide all credentials for grunt-ftpush.

@Grawl
Copy link

Grawl commented Nov 17, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants