diff --git a/README.md b/README.md index be7b983..618bbb1 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ I´m a sick Fuck i like the sick F09ck ```bash docker build -t name/cont:ver . -docker run -e TS3_IP="0.0.0.0", TS3_PW="f3gWdOU3", WEB_PORT="8080" -d -p 8080:8080 name/cont:ver +docker run -e TS3_IP="" -e TS3_PW="" -e WEB_PORT="8080" -d -p 8080:8080 name/cont:ver ``` ENV: ```Docker @@ -49,10 +49,10 @@ The config file is generated automatically on first startup. ## URL-Parameter -| Name | Type | Description | -| ---------- | -------- | ------------------------ | -| `pretty` | `bool` | pretty-prints JSON | -| `envelope` | `bool` | wraps JSON in data array | +| Name | Type | Description | +| ---------- | ------ | ------------------------ | +| `pretty` | `bool` | pretty-prints JSON | +| `envelope` | `bool` | wraps JSON in data array | ## Channels diff --git a/main.go b/main.go index 0d28d9f..1480e3f 100644 --- a/main.go +++ b/main.go @@ -16,16 +16,23 @@ import ( "git.cliffbreak.de/Cliffbreak/tsviewer/service" "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" + "github.com/go-chi/cors" ) func Routes(s service.Service, t template.Template) *chi.Mux { router := chi.NewRouter() + cors := cors.New(cors.Options{ + AllowedOrigins: []string{"*"}, + AllowedMethods: []string{"Get"}, + }) router.Use( middleware.Logger, middleware.Timeout(5*time.Second), middleware.DefaultCompress, middleware.RedirectSlashes, middleware.Recoverer, + + cors.Handler, ) router.Route("/v1", func(r chi.Router) {