use a context with a timeout
This commit is contained in:
parent
6e28def121
commit
a8200b89c1
14
main.go
14
main.go
@ -23,19 +23,23 @@ import (
|
|||||||
"tailscale.com/types/logger"
|
"tailscale.com/types/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed schema.sql
|
var (
|
||||||
var schema string
|
//go:embed schema.sql
|
||||||
|
schema string
|
||||||
|
|
||||||
//go:embed assets
|
//go:embed assets
|
||||||
var assets embed.FS
|
assets embed.FS
|
||||||
|
appCtx, cancel = context.WithTimeout(context.Background(), 3*time.Second)
|
||||||
|
)
|
||||||
|
|
||||||
var app = &App{
|
var app = &App{
|
||||||
ctx: context.Background(),
|
ctx: appCtx,
|
||||||
tsServer: &tsnet.Server{},
|
tsServer: &tsnet.Server{},
|
||||||
tsLocalClient: &tailscale.LocalClient{},
|
tsLocalClient: &tailscale.LocalClient{},
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
defer cancel()
|
||||||
name := flag.String("name", "startpage", "name of service")
|
name := flag.String("name", "startpage", "name of service")
|
||||||
key := flag.String("key", "", "path to file containing the api key")
|
key := flag.String("key", "", "path to file containing the api key")
|
||||||
watchInterval := flag.Int64("refresh", 5, "number of minutes between watch refresh")
|
watchInterval := flag.Int64("refresh", 5, "number of minutes between watch refresh")
|
||||||
|
Loading…
Reference in New Issue
Block a user