cypress-rails
cypress-rails copied to clipboard
Support for a custom "binds" argument to the Rails server
Puma and Rails support a "binds" argument that's useful for SSL support. For example:
bundle exec rails s -b 'ssl://127.0.0.1:3000?key=/etc/nginx/server.key&cert=/etc/nginx/server.crt'
Is there a way of passing this argument through Cypress Rails? I tried using CYPRESS_RAILS_HOST
but results in this error:
CYPRESS_RAILS_HOST='ssl://127.0.0.1:3000?key=/etc/nginx/server.key&cert=/etc/nginx/server.crt' bundle exec cypress-rails run
cypress-rails configuration:
============================
CYPRESS_RAILS_DIR....................."/home/ubuntu/code/academia-app"
CYPRESS_RAILS_HOST...................."ssl://127.0.0.1:3000?key=/etc/nginx/server.key&cert=/etc/nginx/server.crt"
CYPRESS_RAILS_PORT....................nil
CYPRESS_RAILS_BASE_PATH..............."/"
CYPRESS_RAILS_TRANSACTIONAL_SERVER....true
CYPRESS_RAILS_CYPRESS_OPTS............""
bundler: failed to load command: cypress-rails (/home/ubuntu/code/rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bin/cypress-rails)
SocketError: getaddrinfo: Name or service not known
/home/ubuntu/code/rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/cypress-rails-c0709714f040/lib/cypress-rails/server.rb:102:in `initialize'
/home/ubuntu/code/rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/cypress-rails-c0709714f040/lib/cypress-rails/server.rb:102:in `new'
/home/ubuntu/code/rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/bundler/gems/cypress-rails-c0709714f040/lib/cypress-rails/server.rb:102:in `find_available_port
That's because it's calling TCPServer.new("ssl://127.0.0.1:3000?key=/etc/nginx/server.key&cert=/etc/nginx/server.crt", 0)
, and I think you can pass only the host (not the protocol, port, or query parameters) when calling TCPServer.new
.
I tried adding another environment variable to override the host value. It seems to work, though I'm running into another issue (perhaps #18), and I'm not sure that doing that doesn't cause other problems.
Alternatively, is there another way you recommend for getting SSL to work with Cypress?
I think this makes sense -- if you're able to get an environment working locally to work on a PR for the proposed environment variable, I'll do my best to help you shepherd it through