Skip to content

Instantly share code, notes, and snippets.

@gf3
Created September 10, 2021 18:29
Show Gist options
  • Save gf3/89b9303c72e7ba0192c09e96b4abaa03 to your computer and use it in GitHub Desktop.
Save gf3/89b9303c72e7ba0192c09e96b4abaa03 to your computer and use it in GitHub Desktop.
Create the `data` part of a kubernetes opaque secret from an ENV file
require "base64"
require "dotenv"
require "yaml"
if ARGV.empty?
puts "Usage: #{__FILE__} <env file>"
exit 1
end
file = ARGV[0]
env = Dotenv.parse(file)
puts env.map { |key, value| [key, Base64.encode64(value).strip] }.to_h.to_yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment