refresh back
This commit is contained in:
@@ -43,11 +43,16 @@ func runServe(cmd *cobra.Command, args []string) error {
|
||||
port = "8888"
|
||||
}
|
||||
|
||||
host := os.Getenv("GO_KNOCKER_SERVE_HOST")
|
||||
if strings.TrimSpace(port) == "" {
|
||||
host = ""
|
||||
}
|
||||
|
||||
r := gin.Default()
|
||||
|
||||
// CORS: разрешаем для локальной разработки
|
||||
r.Use(cors.New(cors.Config{
|
||||
AllowOrigins: []string{"http://localhost:4200", "http://127.0.0.1:8888", "http://localhost:8888"},
|
||||
AllowOrigins: []string{"http://localhost:4200", "http://127.0.0.1:8888", "http://localhost:" + port},
|
||||
AllowMethods: []string{"GET", "POST", "OPTIONS"},
|
||||
AllowHeaders: []string{"Authorization", "Content-Type"},
|
||||
AllowCredentials: true,
|
||||
@@ -65,6 +70,6 @@ func runServe(cmd *cobra.Command, args []string) error {
|
||||
setupCryptoRoutes(api, passHash)
|
||||
setupStaticRoutes(r, embeddedFS)
|
||||
|
||||
fmt.Printf("Serving on :%s\n", port)
|
||||
return r.Run(":" + port)
|
||||
fmt.Printf("Serving on %s:%s\n", host, port)
|
||||
return r.Run(host + ":" + port)
|
||||
}
|
||||
|
Reference in New Issue
Block a user