nic-chen commented on a change in pull request #693:
URL: https://github.com/apache/apisix-dashboard/pull/693#discussion_r517787238



##########
File path: api/conf/conf.go
##########
@@ -79,12 +82,19 @@ type Config struct {
 }
 
 func init() {
-       flag.StringVar(&confDir, "c", "./conf/", "conf dir")
-       flag.Parse()
+       //go test
+       if strings.HasSuffix(os.Args[0], ".test") {
+               _, basePath, _, _ := runtime.Caller(0)
+               confDir = filepath.Dir(basePath) + "/"
+               fmt.Println("confDir:", confDir)
+       } else {
+               flag.StringVar(&confDir, "c", "./conf/", "conf dir")

Review comment:
       it's better. and user don't need to config other dirs or file paths.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to