Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

82 lines (67 sloc) 1.606 kb
Example
=======
require 'funfig'
UploadConf = Funfig.new do
p.root '/services'
g.nginx do
p.folder { File.join(_.root, 'nginx') }
p.port '8000'
end
p.public_ip_port '*:80'
end
conf = UploadConf.new
p conf.nginx.folder
conf.root = "~/MailProject/upload"
p conf.nginx.folder
conf.each {|k,v| puts "#{k} #{v}"}
p conf
p conf.to_hash()
p conf.to_hash(true)
Up1Conf = UploadConf.clone do
g.nginx do
p.folder { File.join(_.root, 'nganx') }
p.location '/public'
end
end
conf1 = Up1Conf.new
conf1.update(conf.to_hash())
p conf1
conf1.nginx_reset!
p conf1
TODO
====
1. define array of same kinds
Conf = Funfig.new do
p.port 8000
p.folder '/folder'
array :servers do
p.port { _parent.port + _pos }
p.folder { File.join(_parent.folder, _pos.to_s) }
end
a.servers1 do
p.port { _parent.port + _pos }
p.folder { File.join(_parent.folder, _pos.to_s) }
end
end
2. define hash of same kinds
Conf = Funfig.new do
hash :environments do
p.host 'localhost'
p.database { "mybase_#{_name}" }
end
h.environments1 do
p.host 'localhost'
p.database { "mybase_#{_name}" }
end
end
3. Correct composition of schemes
ConfServ = Funfig.new do
p.port 80
p.ip '192.168.168.192'
end
ConfApp = Funfig.new do
p.path '/srv/path'
g.server ConfServ do
p.path { _.path }
end
end
Jump to Line
Something went wrong with that request. Please try again.