优化apollo迁移工具
This commit is contained in:
		@ -13,7 +13,6 @@ import (
 | 
				
			|||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"io/ioutil"
 | 
						"io/ioutil"
 | 
				
			||||||
	"net/http"
 | 
						"net/http"
 | 
				
			||||||
	"strings"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/ddliu/go-httpclient"
 | 
						"github.com/ddliu/go-httpclient"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
@ -24,17 +23,6 @@ import (
 | 
				
			|||||||
//
 | 
					//
 | 
				
			||||||
// Date : 4:06 下午 2021/11/30
 | 
					// Date : 4:06 下午 2021/11/30
 | 
				
			||||||
func NewApolloMigrate(getAllApolloConfigURL string, appID string, env string, namespace string, cookie map[string]string, header map[string]string) ITransform {
 | 
					func NewApolloMigrate(getAllApolloConfigURL string, appID string, env string, namespace string, cookie map[string]string, header map[string]string) ITransform {
 | 
				
			||||||
	if len(getAllApolloConfigURL) == 0 {
 | 
					 | 
				
			||||||
		getAllApolloConfigURL = "http://test-apollo.portal.life.ke.com/apps/{APP_ID}/envs/{ENV}/clusters/default/namespaces/{NAMESPACE}/releases/active?page=0&size=1"
 | 
					 | 
				
			||||||
		replaceMap := map[string]string{
 | 
					 | 
				
			||||||
			"{APP_ID}":    appID,
 | 
					 | 
				
			||||||
			"{ENV}":       env,
 | 
					 | 
				
			||||||
			"{NAMESPACE}": namespace,
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		for k, v := range replaceMap {
 | 
					 | 
				
			||||||
			getAllApolloConfigURL = strings.ReplaceAll(getAllApolloConfigURL, k, v)
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if cookie == nil {
 | 
						if cookie == nil {
 | 
				
			||||||
		cookie = make(map[string]string)
 | 
							cookie = make(map[string]string)
 | 
				
			||||||
		header = make(map[string]string)
 | 
							header = make(map[string]string)
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user