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

Command line args to make local running easier #77

Closed
wants to merge 6 commits into from

Conversation

byronrthomas
Copy link

It can be tricky to use routemaster locally without hacking the config because:

  • webhooks are contained in the config and typically point to production endpoints (e.g. https://www.example.com), so in order to avoid sending bogus requests to production services you typically find-replace in the config e.g. https://www.example.com -> http://localhost:8000
  • certain logger pluggins e.g. prometheus / sentry also assume that routemaster runs in a production-like setting - you typically remove these loggers from the config in order to run locally

This change adds command line options & associated config to workaround these issues and make running locally possible without hacking config in these ways, specifically:

  1. add a command-line option --local which looks for a newly added localport setting in the webhooks config items
    • when --local is set and the webhook called matches a given webhook config that has a localport setting, the URL is overridden to use HTTP scheme and a netloc of 'localhost:{0}'.format(x) where x is the value of localport in the config
  2. add a command-line option --python-logging-only which skips instantiation of any loggers that are not the basic routemaster PythonLogger, so the advanced loggers will not be used

This has been tested manually. I'm not sure that the webhooks config is the ideal place for this - it seems like there may be an alternative that's higher up the config tree and a bit more specific to this case. Also, I'm open to suggestions for alternative names of these options if people don't think the names are helpful.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.6%) to 99.257% when pulling 98c576c on local-usage-improvements into 17db5ac on master.

@danpalmer
Copy link
Contributor

danpalmer commented Aug 4, 2020

Will re-open if we think this is useful when working on Routemaster next, but I think there might be a better way of doing this, potentially with Peter's changes to the config system.

@danpalmer danpalmer closed this Aug 4, 2020
@danpalmer danpalmer deleted the local-usage-improvements branch August 4, 2020 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants