feat: add listen_host (#550)
This commit is contained in:
parent
be51c5a1e6
commit
3fb49693d9
@ -112,7 +112,7 @@ func main() {
|
|||||||
singleton.InitDBFromPath(dashboardCliParam.DatebaseLocation)
|
singleton.InitDBFromPath(dashboardCliParam.DatebaseLocation)
|
||||||
initSystem()
|
initSystem()
|
||||||
|
|
||||||
l, err := net.Listen("tcp", fmt.Sprintf(":%d", singleton.Conf.ListenPort))
|
l, err := net.Listen("tcp", fmt.Sprintf("%s:%d", singleton.Conf.ListenHost, singleton.Conf.ListenPort))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -135,7 +135,7 @@ func main() {
|
|||||||
go dispatchReportInfoTask()
|
go dispatchReportInfoTask()
|
||||||
|
|
||||||
if err := graceful.Graceful(func() error {
|
if err := graceful.Graceful(func() error {
|
||||||
log.Println("NEZHA>> Dashboard::START", singleton.Conf.ListenPort)
|
log.Printf("NEZHA>> Dashboard::START ON %s:%d", singleton.Conf.ListenHost, singleton.Conf.ListenPort)
|
||||||
return muxServer.Serve(l)
|
return muxServer.Serve(l)
|
||||||
}, func(c context.Context) error {
|
}, func(c context.Context) error {
|
||||||
log.Println("NEZHA>> Graceful::START")
|
log.Println("NEZHA>> Graceful::START")
|
||||||
|
@ -30,6 +30,7 @@ type Config struct {
|
|||||||
JWTSecretKey string `mapstructure:"jwt_secret_key" json:"jwt_secret_key,omitempty"`
|
JWTSecretKey string `mapstructure:"jwt_secret_key" json:"jwt_secret_key,omitempty"`
|
||||||
AgentSecretKey string `mapstructure:"agent_secret_key" json:"agent_secret_key,omitempty"`
|
AgentSecretKey string `mapstructure:"agent_secret_key" json:"agent_secret_key,omitempty"`
|
||||||
ListenPort uint `mapstructure:"listen_port" json:"listen_port,omitempty"`
|
ListenPort uint `mapstructure:"listen_port" json:"listen_port,omitempty"`
|
||||||
|
ListenHost string `mapstructure:"listen_host" json:"listen_host,omitempty"`
|
||||||
InstallHost string `mapstructure:"install_host" json:"install_host,omitempty"`
|
InstallHost string `mapstructure:"install_host" json:"install_host,omitempty"`
|
||||||
TLS bool `mapstructure:"tls" json:"tls,omitempty"`
|
TLS bool `mapstructure:"tls" json:"tls,omitempty"`
|
||||||
Location string `mapstructure:"location" json:"location,omitempty"` // 时区,默认为 Asia/Shanghai
|
Location string `mapstructure:"location" json:"location,omitempty"` // 时区,默认为 Asia/Shanghai
|
||||||
|
Loading…
Reference in New Issue
Block a user