name=flag.String("name",shortHostname(),"Name for this node")
name=flag.String("name",hostname(),"Name for this node (FQDN)")
publicIPs=util.IPListFlag("public-ip","Public IP for this machine (may be specified more than once). If unset, the program will try to resolve the local hostname, or it will fall back to inspecting network devices.")
peerIP=util.IPFlag("peer-ip","Internal IP for this machine (within the cluster), if different from --ip")
httpPort=flag.Int("http-port",80,"HTTP port")
...
...
@@ -47,11 +47,8 @@ var (
sessionTTL=5
)
funcshortHostname()string{
funchostname()string{
hostname,_:=os.Hostname()
ifr:=strings.Index(hostname,".");r>=0{
returnhostname[:r]
}
returnhostname
}
...
...
@@ -84,6 +81,9 @@ func main() {
if*name==""{
log.Fatal("--name must be set")
}
if!strings.Contains(*name,".")&&*httpsPort>0{
log.Fatal("--name must be a FQDN when SSL is enabled")