-
Notifications
You must be signed in to change notification settings - Fork 21
/
main.go
34 lines (28 loc) · 684 Bytes
/
main.go
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
package main
import (
"os"
log "github.com/sirupsen/logrus"
"github.com/valyala/fasthttp"
)
type options struct {
AccountSid string
AuthToken string
Receiver string
Sender string
}
func main() {
opts := options{
AccountSid: os.Getenv("SID"),
AuthToken: os.Getenv("TOKEN"),
Receiver: os.Getenv("RECEIVER"),
Sender: os.Getenv("SENDER"),
}
if opts.AccountSid == "" || opts.AuthToken == "" || opts.Sender == "" {
log.Fatal("'SID', 'TOKEN' and 'SENDER' environment variables need to be set")
}
o := NewMOptionsWithHandler(&opts)
err := fasthttp.ListenAndServe(":9090", o.HandleFastHTTP)
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
}