manager-api -p parameter doesn't work, it will prompt panic: fail to read configuration: ./conf/conf.yaml
output to another dirln -s create manager-api soft links to /usr/bin/path/to/outputpanic: fail to read configuration: ./conf/conf.yaml@nic-chen
@tokers
seems cobra doesn't works here:
https://github.com/apache/apisix-dashboard/blob/master/api/cmd/managerapi.go#L114

The conf path will append the conf/conf.yaml, it's not the filename of configuration, but the super path of it.
We may need to change it, it's not so intuitive.
Will this be addressed in M2.3?
Will this be addressed in M2.3?
confirm
who is going to take this?
@nic-chen @tokers What is your opinion?
@nic-chen @tokers What is your opinion?
yes,we need to fix in M2.3
+1 for same issue.
After digging deeper into this issue, I found that conf.WorkDir would always be ., cause the config initialization process defined in the init() function under github.com/apisix/manager-api/internal/log package would be definitely executed in prior to setting Cobra command flags.
So I could get through with this via commenting out https://github.com/apache/apisix-dashboard/blob/62d1c439f37c98ca459f1ce2a0c15273575d2bce/api/internal/conf/conf.go#L103-L106 .
While if proceed, I would still got the following error:
➜ apache-apisix ./manager-api -p output
panic: couldn't open sink "logs/error.log": open logs/error.log: no such file or directory
goroutine 1 [running]:
github.com/apisix/manager-api/internal/log.fileWriter(0x1010200, 0x1650e252fc378834, 0xc00039fdf0)
/Users/imjoey/Work/apache-apisix/apisix-dashboard/api/internal/log/zap.go:98 +0x208
github.com/apisix/manager-api/internal/log.GetLogger(0x0, 0x14)
/Users/imjoey/Work/apache-apisix/apisix-dashboard/api/internal/log/zap.go:38 +0x3f
github.com/apisix/manager-api/internal/log.InitLogger(...)
/Users/imjoey/Work/apache-apisix/apisix-dashboard/api/internal/log/zap.go:35
github.com/apisix/manager-api/internal/log.init.0()
/Users/imjoey/Work/apache-apisix/apisix-dashboard/api/internal/log/zap.go:32 +0x26
The reason of this log error is the same as conf.WorkDir . So I commented out https://github.com/apache/apisix-dashboard/blob/62d1c439f37c98ca459f1ce2a0c15273575d2bce/api/internal/log/zap.go#L30-L33
Then I added log.InitLogger() after the line of code: https://github.com/apache/apisix-dashboard/blob/62d1c439f37c98ca459f1ce2a0c15273575d2bce/api/cmd/managerapi.go#L59
After done all the above, the bugs gone and everything worked fine. While honestly speaking, I'm not quite sure about the relationship between the integration tests and those two init() functions (See the TODO comments above the original code). You will be much appreciated if anyone can elaborate on it? Thanks.
Hi, @imjoey
I'm not quite sure about the relationship between the integration tests and those two
init()functions
Because we did not have E2E testing before, it is a quick solution to integrate ETCD directly in the unit test.
PR is welcome. You could just fix this bug, because we need more time to completely remove the integration of ETCD in the unit test.
@nic-chen @tokers How to fix this bug in M2.3? any suggested steps are welcome.
Hi, @imjoey
I'm not quite sure about the relationship between the integration tests and those two
init()functionsBecause we did not have E2E testing before, it is a quick solution to integrate ETCD directly in the unit test.
PR is welcome. You could just fix this bug, because we need more time to completely remove the integration of ETCD in the unit test.
@nic-chen thanks for your guide. OK, I will propose a PR to fix this first.
Most helpful comment
+1 for same issue.
After digging deeper into this issue, I found that
conf.WorkDirwould always be., cause the config initialization process defined in theinit()function undergithub.com/apisix/manager-api/internal/logpackage would be definitely executed in prior to setting Cobra command flags.So I could get through with this via commenting out https://github.com/apache/apisix-dashboard/blob/62d1c439f37c98ca459f1ce2a0c15273575d2bce/api/internal/conf/conf.go#L103-L106 .
While if proceed, I would still got the following error:
The reason of this log error is the same as
conf.WorkDir. So I commented out https://github.com/apache/apisix-dashboard/blob/62d1c439f37c98ca459f1ce2a0c15273575d2bce/api/internal/log/zap.go#L30-L33Then I added
log.InitLogger()after the line of code: https://github.com/apache/apisix-dashboard/blob/62d1c439f37c98ca459f1ce2a0c15273575d2bce/api/cmd/managerapi.go#L59After done all the above, the bugs gone and everything worked fine. While honestly speaking, I'm not quite sure about the relationship between the integration tests and those two
init()functions (See theTODOcomments above the original code). You will be much appreciated if anyone can elaborate on it? Thanks.