-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cli) kong prepare cli command to prepare prefix #2706
Conversation
8b21c3b
to
8bab7f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool stuff 👍 The implementation is fine but there are some things we can definitely improve here - including the tests that seem rather sparse.
prefix = args.prefix | ||
})) | ||
|
||
local ok, err = prefix_handler.prepare_prefix(conf, args.nginx_conf) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are missing this nginx-conf
argument from the command's options?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in last commit.
kong/cmd/prepare.lua
Outdated
local lapp = [[ | ||
Usage: kong prepare [OPTIONS] | ||
|
||
Prepares the Kong prefix in the configured prefix directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CLI's help messages do not use the third person. Should be Prepare the Kong prefix...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The help message should also include an Example usage like the kong compile
command does, to help the user understand the use-case that this command solves:
Prepare the Kong prefix in the configured prefix directory. This command can
be used to start Kong from the nginx binary without using the 'kong start' command.
Example usage:
kong prepare -p /usr/local/kong -c kong.conf && nginx -p /usr/local/kong -c nginx.conf
kong/cmd/prepare.lua
Outdated
local ok, err = prefix_handler.prepare_prefix(conf, args.nginx_conf) | ||
if not ok then | ||
log.verbose("could not prepare Kong") | ||
error(err) -- report to main error handler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A better experience would be to log:
if not ok then
error("could not prepare Kong prefix at " .. conf.prefix ..
": " .. err)
end
b379d31
to
8312eb7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, but... wasn't this supposed to replace the compile
command? So shouldn't that one be removed?
@Tieske we decided to keep both for the time being, but deprecate |
@thefosk ok, but then a deprecation warning should be added to the docs |
8312eb7
to
a5b166c
Compare
@Tieske Deprecated with Kong/docs.konghq.com@a68553c |
WARN logs used to be printed on stdout instead of stderr. This makes WARN logs conflict with commands whose output from stdout (like 'kong compile') is used to generate something.
Full changelog
kong prepare
command that only prepares the prefix.Documentation at Kong/docs.konghq.com@c5b332e