Skip to content

Instantly share code, notes, and snippets.

@matti
Created June 2, 2021 18:26
Show Gist options
  • Save matti/f535e362adcad6929155638c2accb388 to your computer and use it in GitHub Desktop.
Save matti/f535e362adcad6929155638c2accb388 to your computer and use it in GitHub Desktop.
require "json"
skipenvs = %w(
_
SHLVL
PATH
TERM
HEROKU_RELEASE_CREATED_AT
HEROKU_DYNO_ID
HEROKU_APP_NAME
DYNO
GEM_HOME
)
input = $stdin.read
lines = input.split("\n")
envs = {}
lines.each do |line|
key, value = line.split("=", 2)
next if skipenvs.include? key
envs[key] = value
end
puts envs.to_json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment