-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
77 lines (69 loc) · 1.61 KB
/
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package main
import (
"os"
"time"
log "github.com/sirupsen/logrus"
"github.com/urfave/cli"
"github.com/vitanovs/versioner/cmd"
"github.com/vitanovs/versioner/version"
)
func init() {
log.SetFormatter(&log.TextFormatter{
QuoteEmptyFields: true,
FullTimestamp: true,
DisableLevelTruncation: true,
TimestampFormat: time.RFC3339,
})
}
func main() {
app := cli.NewApp()
app.Name = "Versioner"
app.Usage = "PostgreSQL schema migrations versioning tool"
app.Version = version.BuildInfo
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "endpoint, e",
Usage: "remote endpoint address",
EnvVar: "VERSIONER_PSQL_ENDPOINT",
Required: true,
},
cli.Int64Flag{
Name: "port, p",
Usage: "remote endpoint port",
EnvVar: "VERSIONER_PSQL_PORT",
Value: 5432,
Required: true,
},
cli.StringFlag{
Name: "database, d",
Usage: "remote endpoint database",
EnvVar: "VERSIONER_PSQL_DATABASE",
Required: true,
},
cli.StringFlag{
Name: "username",
Usage: "remote endpoint username",
EnvVar: "VERSIONER_PSQL_USERNAME",
Required: true,
},
cli.StringFlag{
Name: "password",
Usage: "remote endpoint password",
EnvVar: "VERSIONER_PSQL_PASSWORD",
Required: true,
},
cli.StringFlag{
Name: "sslmode, s",
Usage: "remote endpoint ssl mode",
EnvVar: "VERSIONER_PSQL_SSLMODE",
Required: true,
},
}
app.Commands = []cli.Command{
cmd.NewMigrationCommand(),
cmd.NewDatabaseCommand(),
}
app.EnableBashCompletion = true
app.BashComplete = cli.DefaultAppComplete
app.Run(os.Args)
}