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



##########
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:
       as we talked right now, we should use `flag.StringVar(&workDir, "p", 
".", "current work dir")`.
   
   support to specify the prefix path via ENV, `APISIX_API_WORKDIR` seems a 
good name for us.
   
   we should support both of them.
   
   ```sh
   # style 1
   manager-api -p /home/xxx/apisix/manager-api
   
   # style 2
   APISIX_API_WORKDIR=/home/xxx/apisix/manager-api manager-api
   ```
   
   @nic-chen what do you think?




----------------------------------------------------------------
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