Skip to content

Instantly share code, notes, and snippets.

@stuartf
Last active December 14, 2015 14:48
Show Gist options
  • Save stuartf/5102896 to your computer and use it in GitHub Desktop.
Save stuartf/5102896 to your computer and use it in GitHub Desktop.
Render 3akai-ux nginx.conf using ruby
#!/usr/bin/env ruby
require 'erb'
require 'ostruct'
require 'json'
namespace = OpenStruct.new
namespace.nginxConf = OpenStruct.new(JSON.parse(IO.read('nginx.json')))
template = IO.read('nginx.conf')
puts ERB.new(template).result(namespace.instance_eval { binding })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment