Skip to content

Add --paste-global-conf option - #1304

Merged
tilgovi merged 2 commits into
benoitc:masterfrom
moriyoshi:moriyoshi/add-paste-global-conf-option
Jul 16, 2016
Merged

tilgovi merged 2 commits into
benoitc:masterfrom
moriyoshi:moriyoshi/add-paste-global-conf-option

Conversation

@moriyoshi

Copy link
Copy Markdown
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.

Comment thread gunicorn/config.py
for e in raw_global_conf:
s = _compat.bytes_to_str(e)
try:
k, v = re.split(r'(?<!\\)=', s, 1)

Copy link
Copy Markdown
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
Copy Markdown
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

tilgovi commented Jul 15, 2016

Copy link
Copy Markdown
Collaborator

LGTM

@tilgovi

tilgovi commented Jul 15, 2016

Copy link
Copy Markdown
Collaborator

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

moriyoshi commented Jul 16, 2016 •

Copy link
Copy Markdown
Contributor Author
  • 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

tilgovi commented Jul 16, 2016

Copy link
Copy Markdown
Collaborator

Thanks!

@moriyoshi

Copy link
Copy Markdown
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