-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
55 lines (50 loc) · 958 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
49
50
51
52
53
54
55
package main
import (
"log"
"os"
"github.com/urfave/cli"
)
func main() {
app := cli.NewApp()
app.Name = "rates"
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "database",
Value: "root@/rates?parseTime=true",
Usage: "MySQL Connection string",
EnvVar: "RATES_DATABASE",
},
}
app.Commands = []cli.Command{
{
Name: "collect",
Usage: "collect rates from source",
Action: collect,
Flags: []cli.Flag{
cli.StringFlag{
Name: "source",
Value: "https://www.bank.lv/vk/ecb_rss.xml",
Usage: "URL to RSS Feed for collector to process",
EnvVar: "RATES_SOURCE",
},
},
},
{
Name: "serve",
Usage: "start serving API",
Action: serve,
Flags: []cli.Flag{
cli.StringFlag{
Name: "listen",
Value: ":3333",
Usage: "Address to bind/listen to",
EnvVar: "RATES_LISTEN",
},
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}