Skip to content
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

Put load_module directives before the stream block #84

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Test/Nginx/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ sub write_config_file ($$) {
if ($LoadModules) {
my @modules = map { "load_module $_;" } grep { $_ } split /\s+/, $LoadModules;
if (@modules) {
$main_config .= join " ", @modules;
$main_config = join " ", @modules, $main_config;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better add a space between these two things to make the resulting nginx.conf look a bit better?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, never mind, a space is already used as a delimiter in the join() call :)

Copy link
Member

@thibaultcha thibaultcha Nov 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This produces the following output:

load_module foo; load_module bar; stream {

    server {
        listen 1985;
        ...
    }
}

I would be in favor of having the following output, which makes debugging easier when inspecting the generated nginx.conf:

load_module foo;
load_module bar;
stream {

    server {
        listen 1985;
        ...
    }
}

This simple change is my suggestion:

Suggested change
$main_config = join " ", @modules, $main_config;
$main_config = join "\n", @modules, $main_config;

}
}

Expand Down