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

Add --paste-global-conf option #1304

Merged

Conversation

moriyoshi
Copy link
Contributor

While bootstraping gunicorn with paster (PasteScript) or pserve (Pyramid) is now discouraged, no options are provided for PasteDeploy users to set global configuration variables from the commandline.

This patch adds the new commandline option --paste-global-conf KEY=VALUE so that the users can pass arbitrary global_conf values to the PasteDeploy entrypoint.

for e in raw_global_conf:
s = _compat.bytes_to_str(e)
try:
k, v = re.split(r'(?<!\\)=', s, 1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The regular expression here is a raw string, so should there be only one backslash?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ignore me. Right. The backslash here is not for character escape but for regular expression escape. Whole reason for the raw is to not have \\\\.

👾 🌔 🚀

@tilgovi
Copy link
Collaborator

tilgovi commented Jul 15, 2016

LGTM

@tilgovi
Copy link
Collaborator

tilgovi commented Jul 15, 2016

Maybe we should add to the docstring that it can be specified multiple times? Also, I wonder if --paste-global is better than --paste-global-conf. When I see the -conf suffix I think of a full configuration, like if it were parsed as JSON syntax or something. Maybe that is just me. How about --paste-var to make it very explicit that it's a single variable?

@moriyoshi
Copy link
Contributor Author

moriyoshi commented Jul 16, 2016

  • Adding docstring

    Makes sense to me.

  • Changing --paste-global-conf to --paste-global or --paste-var

    Also sounds reasonable. For me --paste-global looks better because there is a concept of "local configuration" and --paste-var would be a bit confusing.

…d adding more description in the docstring.
@tilgovi tilgovi merged commit d468d5b into benoitc:master Jul 16, 2016
@tilgovi
Copy link
Collaborator

tilgovi commented Jul 16, 2016

Thanks!

@moriyoshi
Copy link
Contributor Author

Thanks for taking care of this!

mjjbell pushed a commit to mjjbell/gunicorn that referenced this pull request Mar 16, 2018
* Add --paste-global-conf option so users can pass arbitrary values to the PasteDeploy entrypoint from cli

* Reflect the suggestions: `--paste-global-conf` => `--paste-global` and adding more description in the docstring.
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.

2 participants