-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.go
50 lines (41 loc) · 923 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
package main
import (
"github.com/takaishi/k8s-github-auth/server"
"github.com/urfave/cli"
"log"
"os"
)
func main() {
log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
app := cli.NewApp()
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "github-base-url",
},
cli.StringFlag{
Name: "github-upload-url",
},
cli.StringFlag{
Name: "organization",
},
}
app.Action = func(c *cli.Context) error {
baseUrl := c.String("github-base-url")
uploadUrl := c.String("github-upload-url")
org := c.String("organization")
if os.Getenv("GITHUB_BASE_URL") != "" {
baseUrl = os.Getenv("GITHUB_BASE_URL")
}
if os.Getenv("GITHUB_UPLOAD_URL") != "" {
uploadUrl = os.Getenv("GITHUB_UPLOAD_URL")
}
if os.Getenv("ORGANIZATION") != "" {
org = os.Getenv("ORGANIZATION")
}
return server.Start(baseUrl, uploadUrl, org)
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}