diff options
author | Matt Holt <[email protected]> | 2015-05-05 00:05:42 -0600 |
---|---|---|
committer | Matt Holt <[email protected]> | 2015-05-05 00:05:42 -0600 |
commit | 1e730a74a031bceef77408e004bc8d75d396e305 (patch) | |
tree | 7007acd2648912dd3a3159a5681de89a8c863a79 /server | |
parent | 4637f14b7f3cbe832717abbfab2a7a14383e0b65 (diff) | |
parent | 46f7930787aed2b133248ad89dd4c750ed6ed4fc (diff) | |
download | caddy-1e730a74a031bceef77408e004bc8d75d396e305.tar.gz caddy-1e730a74a031bceef77408e004bc8d75d396e305.zip |
Merge pull request #50 from ChannelMeter/core/bind_address
core: Add the option to specify what address to bind on in Caddyfile
Diffstat (limited to 'server')
-rw-r--r-- | server/config.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/server/config.go b/server/config.go index 591f9a48c..b037b613c 100644 --- a/server/config.go +++ b/server/config.go @@ -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) } |