Skip to content

Instantly share code, notes, and snippets.

@gf3
Created Sep 10, 2021
Embed
What would you like to do?
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