-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
38 lines (32 loc) · 695 Bytes
/
main.go
File metadata and controls
38 lines (32 loc) · 695 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main
import (
"context"
"flag"
"log"
"net/http"
"os"
"os/signal"
"syscall"
"github.com/cptaffe/email2rss/internal/server"
"gocloud.dev/blob"
_ "gocloud.dev/blob/gcsblob"
)
var (
templatePath = flag.String("templates", "", "Path to the templates folder")
)
func main() {
flag.Parse()
ctx := context.Background()
signal.NotifyContext(ctx, os.Interrupt, syscall.SIGTERM)
bucket, err := blob.OpenBucket(ctx, "gs://connor.zip")
if err != nil {
log.Fatalf("open bucket: %v", err)
return
}
defer bucket.Close()
s, err := server.NewServer(ctx, *templatePath, bucket)
if err != nil {
log.Fatalf("init server: %v", err)
}
http.ListenAndServe("0.0.0.0:8080", s)
}