Forráskód Böngészése

fix(store): the db path must be fixed

Due to CI and other tools' requirement

Signed-off-by: Jiyong Huang <huangjy@emqx.io>
Jiyong Huang 3 éve
szülő
commit
62f5b333e4

+ 0 - 3
docs/en_US/operation/configuration_file.md

@@ -146,7 +146,6 @@ In order to use redis as store type property must be changed into redis value.
 ### Sqlite
     
 It has properties
-* path - if left empty database will be created in the data directory of the kuiper base key
 * name - name of database file - if left empty it will be `sqliteKV.db`
  
 ### Redis
@@ -169,8 +168,6 @@ It has properties
         #Timeout in ms
         timeout: 1000
       sqlite:
-        #Sqlite absolute database path, if left empty default directory of the application will be used
-        path:
         #Sqlite file name, if left empty name of db will be sqliteKV.db
         name:
 ```

+ 0 - 3
docs/zh_CN/operation/configuration_file.md

@@ -145,7 +145,6 @@ http://host:port/kuiper-plugins/0.9.1/alpine/functions
 ### Sqlite
 
 可配置如下属性:
-* path - 配置 sqlite 存储路径。若为空则存储在默认的 data 目录中。
 * name - 数据库文件名。若为空,则设置为默认名字`sqliteKV.db`。
 
 ### Redis
@@ -169,8 +168,6 @@ http://host:port/kuiper-plugins/0.9.1/alpine/functions
         #Timeout in ms
         timeout: 1000
       sqlite:
-        #Sqlite absolute database path, if left empty default directory of the application will be used
-        path:
         #Sqlite file name, if left empty name of db will be sqliteKV.db
         name:
 ```

+ 0 - 2
etc/kuiper.yaml

@@ -63,7 +63,5 @@ store:
     #Timeout in ms
     timeout: 1000
   sqlite:
-    #Sqlite absolute database path, if left empty default directory of the application will be used
-    path:
     #Sqlite file name, if left empty name of db will be sqliteKV.db
     name:

+ 0 - 1
internal/conf/conf.go

@@ -84,7 +84,6 @@ type KuiperConf struct {
 			Timeout  int    `yaml:"timeout"`
 		}
 		Sqlite struct {
-			Path string `yaml:"path"`
 			Name string `yaml:"name"`
 		}
 	}

+ 12 - 8
internal/pkg/store/setup.go

@@ -39,18 +39,22 @@ func SetupDefault() error {
 	return Setup(c)
 }
 
-func SetupWithKuiperConfig(conf *conf.KuiperConf) error {
+func SetupWithKuiperConfig(kconf *conf.KuiperConf) error {
+	dir, err := conf.GetDataLoc()
+	if err != nil {
+		return err
+	}
 	c := db.Config{
-		Type: conf.Store.Type,
+		Type: kconf.Store.Type,
 		Redis: redis.Config{
-			Host:     conf.Store.Redis.Host,
-			Port:     conf.Store.Redis.Port,
-			Password: conf.Store.Redis.Password,
-			Timeout:  conf.Store.Redis.Timeout,
+			Host:     kconf.Store.Redis.Host,
+			Port:     kconf.Store.Redis.Port,
+			Password: kconf.Store.Redis.Password,
+			Timeout:  kconf.Store.Redis.Timeout,
 		},
 		Sqlite: sqlite.Config{
-			Path: conf.Store.Sqlite.Path,
-			Name: conf.Store.Sqlite.Name,
+			Path: dir,
+			Name: kconf.Store.Sqlite.Name,
 		},
 	}
 	return Setup(c)