jiangfucheng commented on code in PR #9521:
URL: https://github.com/apache/apisix/pull/9521#discussion_r1259707605
##########
apisix/cli/ops.lua:
##########
@@ -807,17 +807,19 @@ local function start(env, ...)
local local_conf_path = profile:yaml_path("config")
local local_conf_path_bak = local_conf_path .. ".bak"
- local ok, err = os_rename(local_conf_path, local_conf_path_bak)
- if not ok then
- util.die("failed to backup config, error: ", err)
- end
- local ok, err1 = lfs.link(customized_yaml, local_conf_path)
- if not ok then
- ok, err = os_rename(local_conf_path_bak, local_conf_path)
+ if not pl_path.exists(local_conf_path_bak) then
+ local ok, err = os_rename(local_conf_path, local_conf_path_bak)
if not ok then
- util.die("failed to recover original config file, error: ",
err)
+ util.die("failed to backup config, error: ", err)
+ end
+ local ok, err1 = lfs.link(customized_yaml, local_conf_path)
+ if not ok then
+ ok, err = os_rename(local_conf_path_bak, local_conf_path)
+ if not ok then
+ util.die("failed to recover original config file, error:
", err)
+ end
+ util.die("failed to link customized config, error: ", err1)
end
- util.die("failed to link customized config, error: ", err1)
end
Review Comment:
I think @tokers is right, we should find a way to access customized config
file directly, but not rename the customized config file to origin
`config.yaml`, it brings too many problems.
I have a simple idea, we can save the custom config file name to a sparate
file(like `.config_name`) when we start apisix, so we can access it directly
when we need it.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]