-
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(conf): Support nginx user conf #2180
Conversation
d9a66eb
to
ee2a839
Compare
Rather than the extra boolean, why not just set the default value as |
@p0pr0ck5 , user may specify some other user during compiling, and he wanna treat it as default user other tan |
I'd say that if a user compiles using a different user, then it's up to them to set it properly in the config file as well. This really seems like an edge case to me. I'd go for the single property with default Maybe @thibaultcha has some thought s on this? |
it's duplicate both comping and configuring the same user. I really wanna set only one parameter |
We'd be bothering everyone with 2 config properties, for a very, very, few people compiling with a different user. Have 1 property for everyone, and 2 actions for only a very few makes more sense to me. Besides that it clutters the config file. |
ee2a839
to
5c958a4
Compare
Should we also update |
kong.conf.default
Outdated
@@ -68,6 +68,8 @@ | |||
# HTTPS requests to the admin API, if | |||
# `admin_ssl` is enabled. | |||
|
|||
#nginx_user = nobody # Specify nginx user. |
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.
We should elaborate on this property's description. Taking inspiration from the Nginx documentation about this directive, we could go with:
Defines user and group credentials used by worker processes.
If group is omitted, a group whose name equals that of user is used.
Ex: [user] [group].
5c958a4
to
fbf8f0e
Compare
@p0pr0ck5 @thibaultcha Spec codes added and description updated. |
lgtm, but deferring to a more senior project member. |
spec/kong_tests.conf
Outdated
@@ -23,6 +23,7 @@ anonymous_reports = off | |||
|
|||
lua_package_path = ?/init.lua;./kong/?.lua | |||
|
|||
nginx_user = root |
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.
This will make the test instances run as root, which is a no-no imo. We can avoid that change and not care about the "override" test, its goal is not to test that each and every property being overridden correctly.
Support user config for nginx, especially when using Kong with docker where the user may be someone weird. Signed-off-by: Wei.ZHAO <[email protected]>
fbf8f0e
to
cfc15e3
Compare
fixed: using default |
@depay Thank you! |
@@ -126,6 +126,7 @@ describe("NGINX conf compiler", function() | |||
describe("compile_nginx_conf()", function() | |||
it("compiles a main NGINX conf", function() | |||
local nginx_conf = prefix_handler.compile_nginx_conf(helpers.test_conf) | |||
assert.matches("user nobody;", nginx_conf, nil, true)) |
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.
Too many )
at the 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.
oops..my fat finger..let me fix it
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.
fixed in #2298
My bad, I didn't have my glasses on. |
Summary
Support user config for nginx, especially when using Kong with docker where the user may be someone weird.
Full changelog
nginx_user
(string) to configure user for nginx.Signed-off-by: Wei.ZHAO [email protected]