改进 监听

This commit is contained in:
Twilight 2024-05-14 15:01:18 +08:00
parent dac88506f6
commit 64b7b2fb06
4 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
AUTH_PASS=pass
LOG_DIR=saved_log
PORT=8009
LISTEN_ADDR=127.0.0.1:8009

View File

@ -22,7 +22,7 @@ func InitConfig() {
}
Gin = gin{
Port: GetEnv("PORT"),
Addr: GetEnv("LISTEN_ADDR"),
}
}
func GetEnv(key string, defaultValue ...string) string {

View File

@ -1,7 +1,7 @@
package config
type gin struct {
Port string
Addr string
}
var Gin gin

View File

@ -38,7 +38,7 @@ func init() {
}
func main() {
err := Router.Run(fmt.Sprintf(":%s", config.Gin.Port))
err := Router.Run(config.Gin.Addr)
if err != nil {
log.Fatal(err)
return