make hostname configurable

This commit is contained in:
Sami Samhuri 2015-03-29 20:06:48 -07:00
parent c905f5c414
commit ff0b565cc5

View file

@ -12,6 +12,7 @@ CONFIG_DEFAULTS = {
dry_run: false,
path: File.expand_path('../test-blog', __FILE__),
host: '127.0.0.1',
hostname: nil,
port: 6706,
}
@ -54,8 +55,8 @@ def authenticated?(auth)
end
end
real_host = $config[:host] == '0.0.0.0' ? 'h.samhuri.net' : $config[:host]
$url_root = "http://#{real_host}:#{$config[:port]}/"
host = $config[:hostname] || $config[:host]
$url_root = "http://#{host}:#{$config[:port]}/"
def url_for(*components)
File.join($url_root, *components)
end