refact(controller): api cors print info identation
This commit is contained in:
parent
fb25839045
commit
c26cf8ebd0
|
|
@ -1,16 +1,17 @@
|
||||||
package cors
|
package cors
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/rs/cors"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"fmt"
|
|
||||||
|
"github.com/rs/cors"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetCorsConfig() cors.Cors {
|
func GetCorsConfig() cors.Cors {
|
||||||
allowedOrigins := getCorsEnvConfig()
|
allowedOrigins := getCorsEnvConfig()
|
||||||
fmt.Println(allowedOrigins)
|
log.Println("API CORS - AllowedOrigins:", allowedOrigins)
|
||||||
return *cors.New(cors.Options{
|
return *cors.New(cors.Options{
|
||||||
AllowedOrigins: allowedOrigins,
|
AllowedOrigins: allowedOrigins,
|
||||||
AllowedMethods: []string{
|
AllowedMethods: []string{
|
||||||
|
|
@ -35,4 +36,4 @@ func getCorsEnvConfig() []string {
|
||||||
return []string{"*"}
|
return []string{"*"}
|
||||||
}
|
}
|
||||||
return strings.Split(val, ",")
|
return strings.Split(val, ",")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user