remove some hardcoded 'localhost's from dev environment (#14801)
Trying to use a local test hostname other than localhost (e.g. discourse.test )for discourse development was difficult due the fact that localhost was hardcoded in a few places. This patch uses existing environment variables to allow a developer to use a different domain when developing. Signed-off-by: Ryan Lerch <rlerch@redhat.com>
This commit is contained in:
parent
8008f95d98
commit
1fffe941bf
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
<p>Then visit the following URL to use Discourse:</p>
|
<p>Then visit the following URL to use Discourse:</p>
|
||||||
|
|
||||||
<h3><a href="http://localhost:4200/">http://localhost:4200</a></h3>
|
<h3><a href="http://<%= Discourse.current_hostname %>:4200/">http://<%= Discourse.current_hostname %>:4200</a></h3>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -5,14 +5,14 @@ require 'pathname'
|
||||||
|
|
||||||
RAILS_ROOT = File.expand_path("../../", Pathname.new(__FILE__).realpath)
|
RAILS_ROOT = File.expand_path("../../", Pathname.new(__FILE__).realpath)
|
||||||
PORT = ENV["UNICORN_PORT"] ||= "3000"
|
PORT = ENV["UNICORN_PORT"] ||= "3000"
|
||||||
|
HOSTNAME = ENV["DISCOURSE_HOSTNAME"] ||= "localhost"
|
||||||
yarn_dir = File.join(RAILS_ROOT, "app/assets/javascripts/discourse")
|
yarn_dir = File.join(RAILS_ROOT, "app/assets/javascripts/discourse")
|
||||||
|
|
||||||
PROXY =
|
PROXY =
|
||||||
if ARGV.include?("--try")
|
if ARGV.include?("--try")
|
||||||
"https://try.discourse.org"
|
"https://try.discourse.org"
|
||||||
else
|
else
|
||||||
"http://localhost:#{PORT}"
|
"http://#{HOSTNAME}:#{PORT}"
|
||||||
end
|
end
|
||||||
|
|
||||||
command =
|
command =
|
||||||
|
|
|
@ -12,7 +12,7 @@ development:
|
||||||
### If you change this setting you will need to
|
### If you change this setting you will need to
|
||||||
### - restart sidekiq if you change this setting
|
### - restart sidekiq if you change this setting
|
||||||
### - rebake all to posts using: `RAILS_ENV=production bundle exec rake posts:rebake`
|
### - rebake all to posts using: `RAILS_ENV=production bundle exec rake posts:rebake`
|
||||||
- "localhost"
|
- "<%= ENV['DISCOURSE_HOSTNAME'] || 'localhost' %>"
|
||||||
variables: <%= ENV.filter { |k,v| k.start_with? 'DISCOURSE_DB_VARIABLES_' }
|
variables: <%= ENV.filter { |k,v| k.start_with? 'DISCOURSE_DB_VARIABLES_' }
|
||||||
.transform_keys { |k| k.slice(('DISCOURSE_DB_VARIABLES_'.length)..).downcase }
|
.transform_keys { |k| k.slice(('DISCOURSE_DB_VARIABLES_'.length)..).downcase }
|
||||||
.to_json %>
|
.to_json %>
|
||||||
|
|
Loading…
Reference in New Issue