소스 검색

add KUIPER_BASE_LOCATION_KEY into env

RockyJin 5 년 전
부모
커밋
66754a7db5
1개의 변경된 파일7개의 추가작업 그리고 0개의 파일을 삭제
  1. 7 0
      common/util.go

+ 7 - 0
common/util.go

@@ -21,6 +21,8 @@ const (
 	log_dir = "/log/"
 )
 
+const KUIPER_BASE_LOCATION_KEY string = "KUIPER_BASE_LOCATION_KEY"
+
 var (
 	Log *logrus.Logger
 	Config *XStreamConf
@@ -219,6 +221,11 @@ func GetLoc(subdir string)(string, error) {
 	if err != nil {
 		return "", err
 	}
+
+	if loc := os.Getenv(KUIPER_BASE_LOCATION_KEY); loc != "" {
+		dir = loc
+	}
+
 	confDir := dir + subdir
 	if _, err := os.Stat(confDir); os.IsNotExist(err) {
 		lastdir := dir