wasmcloud/cmd/wasmc/api.go

18 lines
281 B
Go

package main
import "net/http"
var apiConfig *Config
func withAPI(req *http.Request) {
if apiConfig == nil {
var err error
apiConfig, err = loadConfig()
if err != nil {
panic(err)
}
}
req.AddCookie(&http.Cookie{Name: "wasmcloud-token", Value: apiConfig.Token})
}