-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
50 lines (43 loc) · 1.49 KB
/
config.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 (
"flag"
"path/filepath"
"k8s.io/client-go/util/homedir"
)
type Config struct {
Addr string
kubeConfig string
Namespace string
GotifyAddress string
GotifyToken string
}
func (c *Config) addFlags() {
flag.StringVar(&c.Addr, "addr", c.Addr, "server address")
if home := homedir.HomeDir(); home != "" {
flag.StringVar(&c.kubeConfig, "kubeconfig", filepath.Join(home, ".kube", "config"), "(optional) absolute path to the kubeconfig file")
} else {
flag.StringVar(&c.kubeConfig, "kubeconfig", "", "absolute path to the kubeconfig file")
}
flag.StringVar(&c.Namespace, "namespace", c.Namespace, "kubernetes namespace")
flag.StringVar(&c.GotifyAddress, "gotify-addr", c.GotifyAddress, "gotify address")
flag.StringVar(&c.GotifyToken, "gotify-token", c.GotifyToken, "gotify token")
}
type Trigger struct {
PushData PushData `json:"push_data"`
Repository Repository `json:"repository"`
}
type PushData struct {
Digest string `json:"digest"`
PushedAt string `json:"pushed_at"`
Tag string `json:"tag"`
}
type Repository struct {
DateCreated string `json:"date_created"`
Name string `json:"name"`
Namespace string `json:"namespace"`
Region string `json:"region"`
RepoAuthenticationType string `json:"repo_authentication_type"`
RepoFullName string `json:"repo_full_name"`
RepoOriginType string `json:"repo_origin_type"`
RepoType string `json:"repo_type"`
}