Skip to content

Instantly share code, notes, and snippets.

@gswallow
Created April 11, 2014 15:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gswallow/10479197 to your computer and use it in GitHub Desktop.
Save gswallow/10479197 to your computer and use it in GitHub Desktop.
Create an SSL cert data bag from raw certificate files
#!/usr/bin/env ruby
require 'json'
id = ARGV.shift
cert = Array.new
ARGV.each do |file|
File.open(file, 'r').each_line do |line|
cert << line.strip
end
end
json = { :id => id, :cert => cert }
puts JSON.pretty_generate(json)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment