Merge branch 'master' of 123niel/tsviewer into master

Geprüft
Mit freundlichen Grüßen
Eichhorn
This commit is contained in:
Moritz 2019-02-07 14:02:28 +00:00 committed by Gitea
commit d57986721d
2 changed files with 12 additions and 5 deletions

View file

@ -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="<SERVER-IP>" -e TS3_PW="<SERVER-ADMIN_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

View file

@ -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) {