tpope / vim-rails

rails.vim: Ruby on Rails power tools
http://www.vim.org/scripts/script.php?script_id=1567
4.1k stars 383 forks source link

Add configurable URI scheme for :Preview #590

Closed dblanken closed 2 years ago

dblanken commented 2 years ago

By default, vim-rails uses http for localhost connections when using :Preview, however some projects I have been working on enforce https in the development environment. This change allows you to override the http default to use https if desired with the g:rails_uri_scheme variable.

let g:rails_uri_scheme = 'https'
tpope commented 2 years ago

I'm going to put my foot down and say this needs to be auto-detected. We already do that with the host and port. Mixing an auto-detected host and port with a global configuration option is a worst of all worlds scenario.

Possible approach 1: Use curl/wget to try each of HTTP and HTTPS. This could become part of the detection process in s:app_server_binding(), changing the interface to return the URI scheme as well.

Possible approach 2: Check a config file for the appropriate option (assuming this is something that's specified in a config file).

Possible approach 3: Use ps to check the server command line for a flag like --ssl (assuming this is something that's specified on the command line).