Protect the environment by deleting + fetching keys: delete!

– Keeping secrets in the environment is convenient, but not every sub-process can be trusted.
– Fail fast when configuration is missing


def ENV.delete!(key)
  delete(key) || raise(KeyError, "key not found: #{key.inspect}")

secret = ENV.delete!('SECRECT')

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s