Improve styles and allowed origin setting

This commit is contained in:
2025-04-14 14:55:02 +01:00
parent efd4b666d9
commit e27535875e
2 changed files with 25 additions and 15 deletions
+7 -1
View File
@@ -24,10 +24,16 @@ func main() {
PORT = "8080"
}
ALLOWED_ORIGIN := os.Getenv("ALLOWED_ORIGIN")
if len(ALLOWED_ORIGIN) == 0 {
ALLOWED_ORIGIN = "https://touch-programming.hazemkrimi.tech"
}
ech := echo.New()
ech.Use(middleware.CORSWithConfig(middleware.CORSConfig{
AllowOrigins: []string{"https://touch-programming.hazemkrimi.tech"},
AllowOrigins: []string{ALLOWED_ORIGIN},
}))
ech.GET("/generate", handlers.Generate)