Skip to content

Commit

Permalink
don't try and delete heroku config vars (#33)
Browse files Browse the repository at this point in the history
* don't try and delete heroku config vars

* fix typo

* fix boolean logic
  • Loading branch information
xavdid authored Aug 11, 2023
1 parent f93f7fe commit b8a7a83
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions commands/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ function* push(context, heroku) {

let res = merge(config.local, config.remote, context.flags)

// remove keys that havne't changed so we don't re-send them
// remove keys that haven't changed so we don't re-send them
// this fixes https://github.com/xavdid/heroku-config/issues/29
// by not writing protected values that it read
Object.keys(res).forEach((k) => {
if (res[k] === config.remote[k]){
// console.log('removing unchanged key', k)
delete res[k]
}
})
Expand All @@ -59,11 +58,16 @@ function* push(context, heroku) {
}

if (context.flags.clean) {
// these are usually owned by heroku, so we shouldn't try to delete them
const IGNORED_KEYS = new Set([
'DATABASE_URL',
'REDIS_URL',
])
// grab keys that weren't in local
let keysToDelete = _.difference(
Object.keys(config.remote),
Object.keys(config.local)
)
).filter(k => !(IGNORED_KEYS.has(k) || k.startsWith('HEROKU_')))
let nullKeys = _.fromPairs(keysToDelete.map(k => [k, null]))

yield patchConfig(
Expand Down

0 comments on commit b8a7a83

Please sign in to comment.