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 option for custom base path #85

Merged
merged 3 commits into from
Aug 25, 2016

Conversation

krsyoung
Copy link
Contributor

The purpose of this code is to support #78 which needs a way to specify a custom base path when running redmon from within Thin.

The common use case for this is to serve redmon from behind a frontend web proxy (currently the assets won't load). This code provides a new command line option that can be used as follows:

bin/redmon --base-path /redmon

This will run the Thin server and serve the content up at http://localhost:4567/redmon. For those running Docker, this will work very nicely with an Image like: https://hub.docker.com/r/vieux/redmon/

Comments & improvements welcomed!

…r that will mount the server on the specified path (useful when running behind proxies).
Update README with latest help (including —base-path)
@krsyoung krsyoung mentioned this pull request Aug 22, 2016
@coveralls
Copy link

Coverage Status

Coverage decreased (-4.9%) to 84.0% when pulling 5bb7eee on krsyoung:add_proxy_option into 9b1a310 on steelThread:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-4.9%) to 84.0% when pulling 5bb7eee on krsyoung:add_proxy_option into 9b1a310 on steelThread:master.

Thin::Server.start(*config.web_interface) do
run Redmon::App.new
map base_path do
Copy link
Owner

Choose a reason for hiding this comment

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

It would be (I need to look to make sure) more efficient if an instance of Redmon::App was constructed outside and then referenced by the block.

app = Redmon::App.new
map base_path do
  run app
end

or if you want to module scope the instance

map base_path do
  run @@app ||= Redmon::App.new
end

thoughts?

- move app instance outside of the map block
@krsyoung
Copy link
Contributor Author

Hey @steelThread thanks for the feedback! I went with the first option for now and tested things (no issue). I also made a change to switch the default base_path to '' vs '/' as it was a little annoying to see the extra trailing slash all of the time when not needed.

Let me know what you think! Thanks

@coveralls
Copy link

coveralls commented Aug 25, 2016

Coverage Status

Coverage decreased (-5.4%) to 83.444% when pulling 4c0deea on krsyoung:add_proxy_option into 9b1a310 on steelThread:master.

@steelThread
Copy link
Owner

@krsyoung - lgtm.

@steelThread steelThread merged commit fc80302 into steelThread:master Aug 25, 2016
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.

None yet

3 participants