forked from hswaw/hscloud
hswaw/site: remove mirko dependency
Change-Id: Id64cccadcd1e109035ed09f62086772fa615dd72 Reviewed-on: https://gerrit.hackerspace.pl/c/hscloud/+/1690 Reviewed-by: q3k <q3k@hackerspace.pl> Reviewed-by: radex <radex@hackerspace.pl>master
parent
d318d7e6d4
commit
a28fa4d7f2
|
@ -14,7 +14,6 @@ go_library(
|
||||||
importpath = "code.hackerspace.pl/hscloud/hswaw/site",
|
importpath = "code.hackerspace.pl/hscloud/hswaw/site",
|
||||||
visibility = ["//visibility:private"],
|
visibility = ["//visibility:private"],
|
||||||
deps = [
|
deps = [
|
||||||
"//go/mirko",
|
|
||||||
"//hswaw/site/calendar",
|
"//hswaw/site/calendar",
|
||||||
"//hswaw/site/static:static_go",
|
"//hswaw/site/static:static_go",
|
||||||
"//hswaw/site/templates:templates_go",
|
"//hswaw/site/templates:templates_go",
|
||||||
|
|
|
@ -11,7 +11,7 @@ It replaces the old [www-main](https://code.hackerspace.pl/q3k/www-main) app.
|
||||||
Running locally
|
Running locally
|
||||||
---
|
---
|
||||||
|
|
||||||
$ bazel run //hswaw/site -- -hspki_disable
|
$ bazel run //hswaw/site
|
||||||
|
|
||||||
And point your web browser to 127.0.0.1:8080.
|
And point your web browser to 127.0.0.1:8080.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
@ -11,7 +12,6 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"code.hackerspace.pl/hscloud/go/mirko"
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
|
|
||||||
"code.hackerspace.pl/hscloud/hswaw/site/calendar"
|
"code.hackerspace.pl/hscloud/hswaw/site/calendar"
|
||||||
|
@ -42,14 +42,12 @@ func main() {
|
||||||
|
|
||||||
rand.Seed(time.Now().UnixNano())
|
rand.Seed(time.Now().UnixNano())
|
||||||
|
|
||||||
mi := mirko.New()
|
// TODO(q3k): use sigint-interruptible context
|
||||||
if err := mi.Listen(); err != nil {
|
ctx := context.Background()
|
||||||
glog.Exitf("Listen failed: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
s := &service{}
|
s := &service{}
|
||||||
go s.feedWorker(mi.Context())
|
go s.feedWorker(ctx)
|
||||||
go s.eventsWorker(mi.Context())
|
go s.eventsWorker(ctx)
|
||||||
|
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
s.registerHTTP(mux)
|
s.registerHTTP(mux)
|
||||||
|
@ -61,11 +59,7 @@ func main() {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if err := mi.Serve(); err != nil {
|
<-ctx.Done()
|
||||||
glog.Exitf("Serve failed: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
<-mi.Done()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
Loading…
Reference in New Issue