-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.go
35 lines (30 loc) · 828 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
package main
import (
"fmt"
"k8sRBACdetect/cmd"
"k8sRBACdetect/conf"
"k8sRBACdetect/structure"
"github.com/spf13/viper"
)
func main() {
cmd.Main()
}
func init() {
viper.SetConfigFile(".\\conf\\conf.yaml")
if err := viper.ReadInConfig(); err != nil {
fmt.Printf("Error reading config file: %s\n", err)
return
}
conf.ApiServer = viper.GetString("apiServer")
conf.ProxyAddress = viper.GetString("proxyAddress")
conf.TokenFile = viper.GetString("auth.0.tokenFile")
conf.Kubeconfig = viper.GetString("auth.1.kubeconfig")
conf.AdminCert = viper.GetString("auth.2.crt")
conf.AdminCert = viper.GetString("auth.2.key")
var sshConfig structure.SSHConfig
if err := viper.UnmarshalKey("ssh.0", &sshConfig); err != nil {
fmt.Printf("Error unmarshalling SSH config: %s\n", err)
return
}
conf.SSH = sshConfig
}