-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
34 lines (28 loc) · 816 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
package main
import (
"github.com/mhvis/planon/planonrpc"
"github.com/spf13/viper"
"net/http"
"crypto/tls"
)
func main() {
// Read config
viper.SetConfigName("config")
viper.AddConfigPath(".")
err := viper.ReadInConfig()
if err != nil {
panic(err)
}
// Get config values
twowayauthUrl := viper.GetString("twowayauth_url")
jUsername := viper.GetString("j_username")
jPassword := viper.GetString("j_password")
apiKeys := viper.GetStringSlice("api_keys")
serverName := viper.GetString("server_name")
insecureSkipVerify := viper.GetBool("insecure_skip_verify")
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{
ServerName: serverName,
InsecureSkipVerify: insecureSkipVerify}
p := planonrpc.NewService(twowayauthUrl, jUsername, jPassword)
listenAndServe(apiKeys, p)
}