allowed origins moved to env
This commit is contained in:
parent
e3f893ac2d
commit
05ed7dc868
4 changed files with 24 additions and 17 deletions
|
|
@ -21,9 +21,10 @@ type router struct {
|
|||
}
|
||||
|
||||
type Deps struct {
|
||||
ApiPrefix string
|
||||
GinMode string
|
||||
TokenProv interfaces.JWTProvider
|
||||
ApiPrefix string
|
||||
GinMode string
|
||||
TokenProv interfaces.JWTProvider
|
||||
AllowedOrigins []string
|
||||
}
|
||||
|
||||
func NewRouter(deps Deps) interfaces.Router {
|
||||
|
|
@ -39,7 +40,7 @@ func NewRouter(deps Deps) interfaces.Router {
|
|||
}
|
||||
|
||||
engine.Use(cors.New(cors.Config{
|
||||
AllowOrigins: []string{"http://localhost:5173"},
|
||||
AllowOrigins: deps.AllowedOrigins,
|
||||
AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
|
||||
AllowHeaders: []string{"Origin", "Content-Type", "Authorization"},
|
||||
ExposeHeaders: []string{"Content-Length"},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue