Fixed port .env usages

This commit is contained in:
Florian Sylvain
2023-01-13 16:29:00 +01:00
parent 6dcd8f234b
commit 5cfea64ebf
2 changed files with 2 additions and 4 deletions
+1 -3
View File
@@ -13,7 +13,6 @@ import (
var (
ginMode string
apiPort string
frontPort string
hostAddress string
)
@@ -24,7 +23,6 @@ func initEnvVariables() {
ginMode = os.Getenv("APP_GIN_MODE")
apiPort = os.Getenv("APP_API_PORT")
frontPort = os.Getenv("APP_FRONT_PORT")
hostAddress = os.Getenv("APP_HOST_ADDRESS")
}
@@ -42,7 +40,7 @@ func initBasicRoutes(r *gin.Engine) {
}
func corsMiddleware(c *gin.Context) {
c.Writer.Header().Set("Access-Control-Allow-Origin", fmt.Sprintf("http://%v:%v", hostAddress, frontPort))
c.Writer.Header().Set("Access-Control-Allow-Origin", fmt.Sprintf("http://%v", hostAddress))
c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")
c.Writer.Header().Set("Access-Control-Allow-Headers", "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With")
c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT")
+1 -1
View File
@@ -1 +1 @@
export const baseApiUrl = `http://${__APP_ENV__.APP_HOST_ADDRESS}:${__APP_ENV__.APP_API_PORT}`
export const baseApiUrl = `http://${__APP_ENV__.APP_HOST_ADDRESS}`