Created
September 10, 2021 18:29
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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