6
6
"fmt"
7
7
"io/ioutil"
8
8
"net/http"
9
+ "os"
9
10
"strings"
10
11
11
12
"github.com/urfave/cli"
@@ -16,6 +17,17 @@ import (
16
17
"k8s.io/client-go/tools/clientcmd/api"
17
18
)
18
19
20
+ var baseCodefreshURL = "https://g.codefresh.io/"
21
+
22
+ func init () {
23
+ // used to debug
24
+ url := os .Getenv ("CODEFRESH_URL" )
25
+ if url != "" {
26
+ fmt .Printf ("Using other url %s\n " , url )
27
+ baseCodefreshURL = url
28
+ }
29
+ }
30
+
19
31
func create (cli * cli.Context ) {
20
32
pathToKubeConfig := cli .String ("config" )
21
33
jwt := cli .String ("token" )
@@ -82,7 +94,7 @@ func create(cli *cli.Context) {
82
94
}
83
95
84
96
func addCluser (host string , contextName string , token []byte , crt []byte , jwt string ) ([]byte , error ) {
85
- url := "http://g.codefresh.io/ api/clusters/local/cluster"
97
+ url := baseCodefreshURL + " api/clusters/local/cluster"
86
98
payload := & requestPayload {
87
99
Type : "sat" ,
88
100
ProviderAgent : "custom" ,
@@ -116,7 +128,7 @@ func addCluser(host string, contextName string, token []byte, crt []byte, jwt st
116
128
}
117
129
118
130
func testConnection (payload * requestPayload , jwt string ) error {
119
- url := "http://g.codefresh.io/ api/kubernetes/test"
131
+ url := baseCodefreshURL + " api/kubernetes/test"
120
132
mar , _ := json .Marshal (payload )
121
133
p := strings .NewReader (string (mar ))
122
134
req , err := http .NewRequest ("POST" , url , p )
0 commit comments