-
-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: cors support for api resource in aws
- Loading branch information
1 parent
87e7468
commit d4d7842
Showing
9 changed files
with
684 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package cors | ||
|
||
import ( | ||
"github.com/imdario/mergo" | ||
v1 "github.com/nitrictech/nitric/core/pkg/api/nitric/v1" | ||
) | ||
|
||
func GetCorsConfig(vals *v1.ApiCorsDefinition) (*v1.ApiCorsDefinition, error) { | ||
defaultVal := &v1.ApiCorsDefinition{ | ||
AllowCredentials: false, | ||
AllowOrigins: []string{"*"}, | ||
AllowHeaders: []string{"Content-Type", "Authorization"}, | ||
AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"}, | ||
ExposeHeaders: []string{}, | ||
MaxAge: 300, | ||
} | ||
|
||
if err := mergo.Merge(defaultVal, vals, mergo.WithOverride); err != nil { | ||
return nil, err | ||
} | ||
|
||
return defaultVal, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.