Simplify setting of urls

Since [1] was merged, all the URL options are set according to
the WEBROOT option. Also the trailing slash is added automatically.

[1] 2a772d64800070689478a49b6aa26a5893b2067b

Change-Id: Ic13cd2e541f21d07ed1b2b1337eeae042dbe2daa
This commit is contained in:
Takashi Kajinami 2023-09-12 01:45:08 +09:00
parent 1ebf203d64
commit 5bc9978891
2 changed files with 3 additions and 28 deletions

View File

@ -62,9 +62,6 @@ describe 'horizon' do
it 'generates local_settings.py' do
verify_concat_fragment_contents(catalogue, 'local_settings.py', [
'DEBUG = False',
"LOGIN_URL = '#{platforms_params[:root_url]}/auth/login/'",
"LOGOUT_URL = '#{platforms_params[:root_url]}/auth/logout/'",
"LOGIN_REDIRECT_URL = '#{platforms_params[:root_url]}/'",
"ALLOWED_HOSTS = ['foo.example.com', ]",
'HORIZON_CONFIG["password_autocomplete"] = "off"',
"SECRET_KEY = secret_key.generate_or_read_from_file('#{platforms_params[:secret_key_file]}')",
@ -746,7 +743,7 @@ describe 'horizon' do
shared_examples_for 'horizon on RedHat' do
it 'sets WEBROOT in local_settings.py' do
verify_concat_fragment_contents(catalogue, 'local_settings.py', [
"WEBROOT = '/dashboard/'",
"WEBROOT = '/dashboard'",
])
end
end
@ -754,7 +751,7 @@ describe 'horizon' do
shared_examples_for 'horizon on Debian' do
it 'sets WEBROOT in local_settings.py' do
verify_concat_fragment_contents(catalogue, 'local_settings.py', [
"WEBROOT = '/horizon/'",
"WEBROOT = '/horizon'",
])
end
end

View File

@ -12,29 +12,7 @@ DEBUG = <%= @django_debug.to_s.capitalize %>
SITE_BRANDING = '<%= @site_branding %>'
<% end -%>
# WEBROOT is the location relative to Webserver root
# should end with a slash.
#LOGIN_URL = WEBROOT + 'auth/login/'
#LOGOUT_URL = WEBROOT + 'auth/logout/'
<% if @root_url == '/' -%>
WEBROOT = '/'
LOGIN_URL = '/auth/login/'
LOGOUT_URL = '/auth/logout/'
<% else -%>
WEBROOT = '<%= @root_url %>/'
LOGIN_URL = '<%= @root_url %>/auth/login/'
LOGOUT_URL = '<%= @root_url %>/auth/logout/'
<% end -%>
# LOGIN_REDIRECT_URL can be used as an alternative for
# HORIZON_CONFIG.user_home, if user_home is not set.
# Do not set it to '/home/', as this will cause circular redirect loop
#LOGIN_REDIRECT_URL = WEBROOT
<% if @root_url == '/' -%>
LOGIN_REDIRECT_URL = '/'
<% else -%>
LOGIN_REDIRECT_URL = '<%= @root_url %>/'
<% end -%>
WEBROOT = '<%= @root_url %>'
# Required for Django 1.5.
# If horizon is running in production (DEBUG is False), set this