]> git.openstreetmap.org Git - chef.git/blob - cookbooks/letsencrypt/files/default/bin/upload
Merge remote-tracking branch 'github/pull/350' into master
[chef.git] / cookbooks / letsencrypt / files / default / bin / upload
1 #!/usr/bin/ruby
2
3 require "json"
4 require "tempfile"
5
6 domain = ARGV.shift
7 directory = ARGV.shift
8
9 bag = {
10   :id => domain,
11   :key => File.read(File.join(directory, "privkey.pem")),
12   :certificate => File.read(File.join(directory, "fullchain.pem"))
13 }
14
15 file = Tempfile.new(["letsencrypt", ".json"])
16
17 file.puts JSON.generate(bag)
18 file.close
19
20 system("/usr/bin/knife", "data", "bag", "from", "file", "letsencrypt", file.path)