use a context with a timeout

This commit is contained in:
Aaron Bieber 2024-05-11 07:50:03 -06:00
parent 6e28def121
commit a8200b89c1
No known key found for this signature in database

14
main.go
View File

@ -23,19 +23,23 @@ import (
"tailscale.com/types/logger"
)
//go:embed schema.sql
var schema string
var (
//go:embed schema.sql
schema string
//go:embed assets
var assets embed.FS
//go:embed assets
assets embed.FS
appCtx, cancel = context.WithTimeout(context.Background(), 3*time.Second)
)
var app = &App{
ctx: context.Background(),
ctx: appCtx,
tsServer: &tsnet.Server{},
tsLocalClient: &tailscale.LocalClient{},
}
func main() {
defer cancel()
name := flag.String("name", "startpage", "name of service")
key := flag.String("key", "", "path to file containing the api key")
watchInterval := flag.Int64("refresh", 5, "number of minutes between watch refresh")