New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

config-heroku

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

config-heroku - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

48

lib/commands/save.js

@@ -15,20 +15,25 @@ // Save command - saves a local config to heroku config.

var configDir = options.configDir || helpers.findFile('config','dir')
var grunt = this
// log
var log = {
write : function(){
if(this.log && this.log.writeln) return this.log.writeln.apply(this.log,arguments)
if(grunt.log && grunt.log.writeln) return grunt.log.writeln.apply(grunt.log,arguments)
console.log.apply(console,arguments)
}.bind(this),
},
warn : function(){
if(this.log && this.log.warn) return this.log.warn.apply(this.log,arguments)
if(grunt.log && grunt.log.warn) return grunt.log.warn.apply(grunt.log,arguments)
console.warn.apply(console,arguments)
}.bind(this),
},
error : function(){
if(this.log && this.log.error) return this.log.error.apply(this.log,arguments)
if(grunt.log && grunt.log.error) return grunt.log.error.apply(grunt.log,arguments)
console.error.apply(console,arguments)
}.bind(this),
},
ok : function(){
if(this.log && this.log.ok) return this.log.ok.apply(this.log,arguments)
if(grunt.log && grunt.log.ok) return grunt.log.ok.apply(grunt.log,arguments)
console.log.apply(console,arguments)
}.bind(this)
},
verbose : function(){
if(grunt.verbose && grunt.verbose.writeln) return grunt.verbose.writeln.apply(grunt.verbose,arguments)
console.log.apply(console,arguments)
}
}

@@ -38,7 +43,10 @@

if(!verified){
return helpers.verifyHerokuApp.call(this,function(ok){
return helpers.verifyHerokuApp.call(grunt,function(ok){
verified = ok
if(!ok) return log.error('Error verifying heroku app & config. Cannot save config.')
saveCommand.call(this,options,confirm,callback)
}.bind(this))
if(!ok){
log.error('Error verifying heroku app & config. Cannot save config.')
return callback(false)
}
saveCommand.call(grunt,options,confirm,callback)
}.bind(grunt))
}

@@ -61,5 +69,7 @@

} else {
log.write("Heroku is currently using the "+currentlyUsing+" config. Use 'config-heroku use <var>' to change.")
log.verbose("Heroku is currently using the "+currentlyUsing+" config. Use 'config-heroku use <var>' to change.")
}
callback()
// restore global config
helpers.reloadConfig(grunt)
callback(!err)
}

@@ -85,7 +95,3 @@

}
// invalidate cache for currently loaded config module
Object.keys(require.cache).forEach(function(p){
if(/node_modules\/config\/lib\/config.js/.test(p)) delete require.cache[p]
})
var config = JSON.parse(JSON.stringify(require('config')))
var config = helpers.reloadConfig(grunt)
// overload config with heroku config

@@ -96,6 +102,6 @@ Object.keys(herokuConfig).forEach(function(k){

var save = function(complete){
log.ok("Saving local config to heroku config...")
log.verbose("Saving local config to heroku config...")
exec('heroku config:add '+varname+"='"+JSON.stringify(config)+"'",function(err,stdout,stderr){
if(err) throw err
log.ok("Done saving. Response:\n"+(stdout || stderr))
log.verbose("Done saving. Response:\n"+(stdout || stderr))
exec('heroku config:get CONFIG_VAR',function(err,stdout,stderr){

@@ -102,0 +108,0 @@ currentlyUsing = stdout.replace(/^[\n\s]*(.*)[\n\s]*$/,'$1')

@@ -6,2 +6,21 @@ // **Helpers**

var reloadConfig = module.exports.reloadConfig = function(grunt){
// invalidate cache for currently loaded config module to ensure we're getting a fresh instance (without runtime.json)
Object.keys(require.cache).forEach(function(p){
if(/node_modules\/config\/lib\/config.js/.test(p)){
if(grunt && grunt.verbose) grunt.verbose.writeln("invalidating cache for loaded config: "+p)
require.cache[p] = null
delete require.cache[p]
}
})
global.NODE_CONFIG = null
delete global.NODE_CONFIG
var config = require('config')
config.watchForConfigFileChanges(0)
config._loadFileConfigs()
config = config._cloneDeep(config)
return config
}
// find the closest dir containing a file or folder, locate ourselves there

@@ -39,3 +58,3 @@ var findFile = module.exports.findFile = function(search,type,path){

var verifyHerokuApp = module.exports.verifyHerokuApp = function(cb){
var log = ((this.log && this.log.writeln.bind(this.log)) || console.log)
var log = ((this.verbose && this.verbose.writeln.bind(this.verbose)) || console.log)
var error = ((this.log && this.log.error.bind(this.log)) || console.error)

@@ -42,0 +61,0 @@ log("looking up heroku app...")

{
"name": "config-heroku",
"version": "0.0.4",
"version": "0.0.5",
"description": "An adapter for using node-config (https://github.com/lorenwest/node-config) on heroku",

@@ -5,0 +5,0 @@ "main": "config-heroku.js",

@@ -26,7 +26,7 @@ // Grunt task for updating heroku config from local config.

grunt.log.writeln('Saving local config to Heroku...'.blue)
save.call(grunt,config, function(conf,cb){ return cb(true) }, function(){
save.call(grunt,config, function(conf,cb){ return cb(true) }, function(success){
grunt.log.writeln("Completed saving config.".blue)
done()
done(success)
})
});
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc