-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.go
88 lines (69 loc) · 1.83 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
78
79
80
81
82
83
84
85
86
87
88
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
package main
import (
"os"
"time"
"github.com/go-vela/server/database"
"github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
_ "github.com/joho/godotenv/autoload"
)
func main() {
app := cli.NewApp()
// Utility Information
app.Name = "vela-migration"
app.HelpName = "vela-migration"
app.Usage = "Vela utility used to migrate from v0.11.x to v0.12.x"
app.Copyright = "Copyright (c) 2022 Target Brands, Inc. All rights reserved."
app.Authors = []*cli.Author{
{
Name: "Vela Admins",
Email: "[email protected]",
},
}
// Utility Metadata
app.Action = run
app.Compiled = time.Now()
app.Version = "v1.0.0"
// Utility Flags
app.Flags = []cli.Flag{
// Action Flags
&cli.BoolFlag{
EnvVars: []string{"VELA_ACTION_ALL", "ACTION_ALL"},
Name: "action.all",
Usage: "enables running all actions for v0.12.x",
},
&cli.BoolFlag{
EnvVars: []string{"VELA_ALTER_TABLES", "ALTER_TABLES"},
Name: "alter.tables",
Usage: "enables altering the table configuration for v0.12.x",
},
&cli.BoolFlag{
EnvVars: []string{"VELA_CREATE_INDEXES", "CREATE_INDEXES"},
Name: "create.indexes",
Usage: "enables creating new indexes for v0.12.x",
},
// Logger Flags
&cli.StringFlag{
EnvVars: []string{"VELA_LOG_FORMAT", "LOG_FORMAT"},
Name: "log.format",
Usage: "set log format for the utility",
Value: "json",
},
&cli.StringFlag{
EnvVars: []string{"VELA_LOG_LEVEL", "LOG_LEVEL"},
Name: "log.level",
Usage: "set log level for the utility",
Value: "info",
},
}
// Database Flags
app.Flags = append(app.Flags, database.Flags...)
// Utility Start
err := app.Run(os.Args)
if err != nil {
logrus.Fatal(err)
}
}