Add --paste-global-conf option #1304

Merged
merged 2 commits into from Jul 16, 2016

Conversation

Projects
None yet
2 participants
@moriyoshi
Contributor

moriyoshi commented Jul 7, 2016

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)

This comment has been minimized.

@tilgovi

tilgovi Jul 15, 2016

Collaborator

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

@tilgovi

tilgovi Jul 15, 2016

Collaborator

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

This comment has been minimized.

@tilgovi

tilgovi Jul 15, 2016

Collaborator

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 Jul 15, 2016

Collaborator

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

This comment has been minimized.

Show comment
Hide comment
@tilgovi

tilgovi Jul 15, 2016

Collaborator

LGTM

Collaborator

tilgovi commented Jul 15, 2016

LGTM

@tilgovi

This comment has been minimized.

Show comment
Hide comment
@tilgovi

tilgovi Jul 15, 2016

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?

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

This comment has been minimized.

Show comment
Hide comment
@moriyoshi

moriyoshi Jul 16, 2016

Contributor
  • 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.

Contributor

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.

@tilgovi tilgovi merged commit d468d5b into benoitc:master Jul 16, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@tilgovi

This comment has been minimized.

Show comment
Hide comment
@tilgovi

tilgovi Jul 16, 2016

Collaborator

Thanks!

Collaborator

tilgovi commented Jul 16, 2016

Thanks!

@moriyoshi

This comment has been minimized.

Show comment
Hide comment
@moriyoshi

moriyoshi Jul 17, 2016

Contributor

Thanks for taking care of this!

Contributor

moriyoshi commented Jul 17, 2016

Thanks for taking care of this!

fofanov pushed a commit to fofanov/gunicorn that referenced this pull request Mar 16, 2018

Add --paste-global-conf option (#1304)
* 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