mirror of
https://github.com/caddyserver/caddy.git
synced 2026-10-21 03:14:17 +00:00
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:
commit
1e730a74a0
3 changed files with 19 additions and 0 deletions
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue