Skip to content

klaaz0r/gulp-convict

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-convict

With this gulp plugin you can use convict in your gulp, it makes it easy to use different configs based on the NODE_ENV.

npm install gulp-convict

howto

you need to give a source with the folder containing all your schema's matching with your environment, so for example I can have a production.js file in my /config folder

export default {
  core: {
    protocol: 'https',
    hostname: 'api.yourdomain.io'
  },
  logger: {
    level: 'debug'
  }
}

This config will be extending or overwriting my default schema, looking like this

export default {
  core: {
    protocol: 'http',
    hostname: 'localhost:9090'
  },
  logger: {
    level: 'trace'
  }
}

the following options are available

name description
name output name
schema base schema file path
log set it true if you want to log out the config file that was made

example

import convict from 'gulp-convict'

gulp.task('config', 'get the config based on env', () => {
  return gulp.src('./config/*.js')
    .pipe(convict({ log: true, schema: __dirname + '/config/schema.js' }))
    .pipe(gulp.dest('./app'))
})

About

⚙️ convict for gulp, create application configurations based on environment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published