Merge pull request #50 from ChannelMeter/core/bind_address

core: Add the option to specify what address to bind on in Caddyfile
This commit is contained in:
Matt Holt 2015-05-05 00:05:42 -06:00
commit 1e730a74a0
3 changed files with 19 additions and 0 deletions

View file

@ -11,6 +11,9 @@ type Config struct {
// The hostname or IP on which to serve
Host string
// The host address to bind on - defaults to (virtual) Host if empty
BindHost string
// The port to listen on
Port string
@ -44,6 +47,9 @@ type Config struct {
// Address returns the host:port of c as a string.
func (c Config) Address() string {
if c.BindHost != "" {
return net.JoinHostPort(c.BindHost, c.Port)
}
return net.JoinHostPort(c.Host, c.Port)
}