Skip to content

feature: resty: impelented the --dry-run option to print out the generated configuration. #42

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

spacewander
Copy link
Member

No description provided.

bin/resty Outdated
@@ -289,6 +289,11 @@ my $lua_shared_dicts = '';
next;
}

if ($arg =~ /^--dry-run$/) {
Copy link
Member

Choose a reason for hiding this comment

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

This is not really a "dry run" in the common sense and thus is confusing. I suggest using the option name --dump-nginx-conf instead? Better be explicit for such features.

@spacewander
Copy link
Member Author

@agentzh
Already changed it to --dump-nginx-conf.

bin/resty Outdated
@@ -289,6 +289,11 @@ my $lua_shared_dicts = '';
next;
}

if ($arg =~ /^--dump-nginx-conf$/) {
Copy link
Member

Choose a reason for hiding this comment

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

I think we should just use the eq operator here since it's a constant string comparison.

bin/resty Outdated
@@ -777,6 +779,16 @@ $loader
}
_EOC_

if ($dump_nginx_conf) {
print $conf;
exit(0);
Copy link
Member

Choose a reason for hiding this comment

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

Better just use exit; here since both the parentheses and 0 can be omitted.

@spacewander
Copy link
Member Author

@agentzh
Updated.

bin/resty Outdated
@@ -894,6 +906,10 @@ Options:
in the future).

-V Print version numbers and nginx configurations.

--dump-nginx-conf Print out the generated nginx configuration file only
without running the Lua code.
Copy link
Member

Choose a reason for hiding this comment

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

I think we can omit "out" and "only" from this sentence, and maybe be more explicit even:

Print the generated nginx configuration file, without running nginx nor the Lua code. 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants