aboutsummaryrefslogtreecommitdiffstats
path: root/api/handlers/index.go
blob: c165f3bbcb31fb71eedf9aba13cf574f3d2e7ccd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package handlers

import (
	"net/http"

	"github.com/LMBishop/gunnel/pkg/config"
	"github.com/LMBishop/gunnel/web"
)

func Index(configService config.Service) func(http.ResponseWriter, *http.Request) {
	return func(w http.ResponseWriter, r *http.Request) {
		web.Index().Execute(w, struct {
			Host        string
			ExpireAfter int
			Iface       string
		}{
			Host:        configService.Config().Hostname,
			ExpireAfter: configService.Config().ExpireAfter,
			Iface:       configService.Config().WireGuard.InterfaceName,
		})
	}
}