-
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) SSL auto-generation + dnsmasq for new CLI #1299
Conversation
b35cdc9
to
9830033
Compare
9830033
to
68a0c29
Compare
|
||
-- Check that the files exist | ||
if not pl_path.exists(ssl_cert) then | ||
return false, "Can't find SSL certificate at: "..ssl_cert |
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.
prefer returning nil
, by convention with the rest of the codebase.
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.
also: to stay consistent, don't capitalize error messages. In the CLI, the errors always appear as:
Error: can't find SSL certificate at: ...
for _, cmd in ipairs(commands) do | ||
local ok, _, _, stderr = pl_utils.executeex(cmd) | ||
if not ok then | ||
return nil, "There was an error when auto-generating the default SSL certificate: "..stderr |
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.
ditto (capitalized) + error could be shorter and consistent with the other errors of the CLI: "could not generate the default SSL cert:"
@@ -1,2 +1,3 @@ | |||
ssl = on | |||
dnsmasq = on | |||
dns_resolver = "8.8.8.8" |
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.
No need for quotes.
… and "serf" folders.
finally(function() | ||
helpers.execute(KILL_ALL) | ||
helpers.dir.rmtree("foobar") | ||
end) |
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.
Please be more careful, this test clearly belongs to a category of "errors" test, as stated by the scoping describe
. If you change the behavior of the CLI (I won't even discuss the legitimacy of automatically creating a non-existing folder on behalf of the user, that is unexpected behavior to me), this is now testing the opposite. This test should be moved outside of the errors.
Agree that passing configuration for stopping a service is not ideal (and it can also be error prone: what happens if somebody updates the configuration files at runtime and then trie to stop/start Kong?). You could store the configuration using nginx's PID as a key (e.g., create a folder for the PID somewhere and store the configuration files for the duration of the application's lifecycle) |
to avoid giving `stop` and other commands a configuration file argument, we now store the configuration in Kong's working directory (or Nginx prefix as it is now refered to).
…efactor/ssl-autogen
kong cluster ..
CLInext
).pids
,logs
andserf
folders.