Skip to content

Commit 1c16005

Browse files
salzigJoschkaSchulz
authored andcommitted
chore: replace /etc/hosts change with RFC6761 localhost
1 parent 0a2ef66 commit 1c16005

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

app/helpers/application_helper.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ def whitelabel_javascript_include_tag
2828
end
2929

3030
def label_auth_url(provider)
31-
host = Rails.env.development? ? "http://#{Whitelabel[:label_id]}.onruby.test:3000" : Whitelabel[:canonical_url]
31+
host = Rails.env.development? ? "http://#{Whitelabel[:label_id]}.onruby.localhost:3000" : Whitelabel[:canonical_url]
3232

3333
"#{host}/auth/#{provider}?origin=#{CGI.escape(params[:origin]) if params[:origin]}"
3434
end
3535

3636
def label_url(label)
37-
host = Rails.env.development? ? "#{label.label_id}.onruby.test" : label.canonical_url
37+
host = Rails.env.development? ? "#{label.label_id}.onruby.localhost" : label.canonical_url
3838
root_url(host:)
3939
end
4040

config/environments/development.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Rails.application.configure do
44
# Settings specified here will take precedence over those in config/application.rb.
5-
config.hosts << /.*onruby\.test.*/
5+
config.hosts << /.*onruby\.localhost.*/
66

77
# In the development environment your application's code is reloaded any time
88
# it changes. This slows down response time but is perfect for development

lib/tasks/data.rake

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace :data do
77
5.times { FactoryBot.create(:event, date: rand(100).days.ago) }
88
5.times { FactoryBot.create(:participant) }
99
end
10-
puts 'now open your browser at http://hamburg.onruby.test:3000/'
10+
puts 'now open your browser at http://hamburg.onruby.localhost:3000/'
1111
end
1212

1313
task setup: ['environment', 'db:migrate'] do

lib/tasks/fork.rake

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ namespace :fork do
3131
FileUtils.mkdir_p(Rails.root.join("app/assets/javascripts/labels/#{usergroup.label_id}"))
3232
FileUtils.touch(Rails.root.join("app/assets/javascripts/labels/#{usergroup.label_id}/.gitkeep"))
3333

34-
puts "now add '127.0.0.1 #{name}.onruby.test' to your /etc/hosts, run 'script/server' and run 'open #{name}.onruby.test:3000'"
34+
puts "now add '127.0.0.1 #{name}.onruby.localhost' to your /etc/hosts, run 'script/server' and run 'open #{name}.onruby.localhost:3000'"
3535
end
3636
end

readme.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ script/in_docker bundle exec rspec spec/requests/labels_spec.rb
7474

7575
#### Add usergroup hostnames to `/etc/hosts`
7676

77+
Note: This step is currently only necessary for Safari, all other browsers thread localhost as wildcard domain.
78+
7779
Add all supported subdomains to your `/etc/hosts` file:
7880

7981
```
80-
127.0.0.1 www.onruby.test hamburg.onruby.test cologne.onruby.test berlin.onruby.test madridrb.onruby.test andalucia.onruby.test
82+
127.0.0.1 www.onruby.test hamburg.onruby.localhost cologne.onruby.localhost berlin.onruby.localhost madridrb.onruby.localhost andalucia.onruby.localhost
8183
```
8284

8385
#### Visit the site

0 commit comments

Comments
 (0)