33 lines
699 B
Go
33 lines
699 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"expvar"
|
|
"flag"
|
|
"log"
|
|
"net/http"
|
|
|
|
"tulpa.dev/cadey/iconia/agent"
|
|
)
|
|
|
|
var (
|
|
agentURL = flag.String("agent-url", "iconia://127.0.0.1:3045/test.local.cetacean.club", "url of iconia server")
|
|
agentToken = flag.String("agent-token", "95FD1C09-47E0-438E-B1AA-40CF41E1CD01", "token to use for iconia")
|
|
)
|
|
|
|
func main() {
|
|
flag.Parse()
|
|
|
|
hitCounter := expvar.NewInt("hits")
|
|
|
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
|
http.Error(w, "Hello world!", http.StatusOK)
|
|
hitCounter.Add(1)
|
|
})
|
|
|
|
ctx, cancel := context.WithCancel(context.Background())
|
|
defer cancel()
|
|
|
|
log.Fatal(agent.Handle(ctx, *agentURL, *agentToken, http.DefaultServeMux))
|
|
}
|