-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.go
48 lines (39 loc) · 874 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
"os"
"strconv"
"github.com/joho/godotenv"
log "github.com/sirupsen/logrus"
)
func main() {
if err := godotenv.Load(); err != nil {
log.Error("Cannot load .env file! Did you copy .env.example to .env?")
return
}
debug, err := strconv.ParseBool(os.Getenv("DEBUG"))
if err != nil {
log.Info("Cannot parse debug level, default to false")
}
if debug {
log.SetLevel(log.DebugLevel)
}
timeout, err := strconv.Atoi(os.Getenv("HTTP_TIMEOUT"))
if err != nil {
timeout = 0
}
onionVersion, err := strconv.Atoi(os.Getenv("ONION_VERSION"))
if err != nil {
onionVersion = onionV2
}
service := &Service{
cfg: &Config{
Filename: os.Getenv("CSV_FILE"),
Timeout: timeout,
TorSocksPort: os.Getenv("TOR_PROXY"),
OnionVersion: onionVersion,
},
}
if err := service.Start(); err != nil {
log.Error(err)
}
}