mirror of
https://github.com/cubixle/vault.git
synced 2026-04-24 23:04:44 +01:00
cors
This commit is contained in:
10
main.go
10
main.go
@@ -15,6 +15,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
|
"github.com/labstack/echo/v4/middleware"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Item holds the data.
|
// Item holds the data.
|
||||||
@@ -31,8 +32,6 @@ type Vault struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// binding.Validator = new(DefaultValidator)
|
|
||||||
router := echo.New()
|
|
||||||
|
|
||||||
appURL := os.Getenv("VAULT_APP_URL")
|
appURL := os.Getenv("VAULT_APP_URL")
|
||||||
if appURL == "" {
|
if appURL == "" {
|
||||||
@@ -44,11 +43,14 @@ func main() {
|
|||||||
port = "8080"
|
port = "8080"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
router := echo.New()
|
||||||
|
|
||||||
router.POST("/", createAction)
|
router.POST("/", createAction)
|
||||||
router.POST("/decrypt", decryptAction)
|
router.POST("/decrypt", decryptAction)
|
||||||
|
|
||||||
//router.Use(CORS(appURL))
|
router.Use(middleware.CORSWithConfig(middleware.CORSConfig{
|
||||||
//router.Use(Logger())
|
AllowOrigins: []string{appURL},
|
||||||
|
}))
|
||||||
|
|
||||||
if err := router.Start(":" + port); err != nil {
|
if err := router.Start(":" + port); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user