Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
fa68e403
Commit
fa68e403
authored
Dec 16, 2015
by
Kamil Trzcinski
Committed by
James Edwards-Jones
Jan 31, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support https and custom port for pages
parent
ac09f857
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
11 deletions
+26
-11
app/models/project.rb
app/models/project.rb
+5
-2
config/gitlab.yml.example
config/gitlab.yml.example
+2
-0
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+19
-9
No files found.
app/models/project.rb
View file @
fa68e403
...
@@ -1165,11 +1165,14 @@ class Project < ActiveRecord::Base
...
@@ -1165,11 +1165,14 @@ class Project < ActiveRecord::Base
def
pages_url
def
pages_url
if
Dir
.
exist?
(
public_pages_path
)
if
Dir
.
exist?
(
public_pages_path
)
host
=
"
#{
namespace
.
path
}
.
#{
Settings
.
pages
.
domain
}
"
host
=
"
#{
namespace
.
path
}
.
#{
Settings
.
pages
.
domain
}
"
url
=
Gitlab
.
config
.
pages
.
url
.
sub
(
/^https?:\/\//
)
do
|
prefix
|
"
#{
prefix
}#{
namespace
.
path
}
."
end
# If the project path is the same as host, leave the short version
# If the project path is the same as host, leave the short version
return
"http://
#{
host
}
"
if
host
==
path
return
url
if
host
==
path
"
http://
#{
host
}
/
#{
path
}
"
"
#{
url
}
/
#{
path
}
"
end
end
end
end
...
...
config/gitlab.yml.example
View file @
fa68e403
...
@@ -163,6 +163,8 @@ production: &base
...
@@ -163,6 +163,8 @@ production: &base
# http://group.example.com/project
# http://group.example.com/project
# or project path can be a group page: group.example.com
# or project path can be a group page: group.example.com
domain: example.com
domain: example.com
port: 80 # Set to 443 if you serve the pages with HTTPS
https: false # Set to true if you serve the pages with HTTPS
## Mattermost
## Mattermost
## For enabling Add to Mattermost button
## For enabling Add to Mattermost button
...
...
config/initializers/1_settings.rb
View file @
fa68e403
...
@@ -5,8 +5,8 @@ class Settings < Settingslogic
...
@@ -5,8 +5,8 @@ class Settings < Settingslogic
namespace
Rails
.
env
namespace
Rails
.
env
class
<<
self
class
<<
self
def
gitlab_on_standard_port?
def
on_standard_port?
(
config
)
gitlab
.
port
.
to_i
==
(
gitlab
.
https
?
443
:
80
)
config
.
port
.
to_i
==
(
config
.
https
?
443
:
80
)
end
end
def
host_without_www
(
url
)
def
host_without_www
(
url
)
...
@@ -14,7 +14,7 @@ class Settings < Settingslogic
...
@@ -14,7 +14,7 @@ class Settings < Settingslogic
end
end
def
build_gitlab_ci_url
def
build_gitlab_ci_url
if
gitlab_on_standard_port?
if
on_standard_port?
(
gitlab
)
custom_port
=
nil
custom_port
=
nil
else
else
custom_port
=
":
#{
gitlab
.
port
}
"
custom_port
=
":
#{
gitlab
.
port
}
"
...
@@ -27,6 +27,10 @@ class Settings < Settingslogic
...
@@ -27,6 +27,10 @@ class Settings < Settingslogic
].
join
(
''
)
].
join
(
''
)
end
end
def
build_pages_url
base_url
(
pages
).
join
(
''
)
end
def
build_gitlab_shell_ssh_path_prefix
def
build_gitlab_shell_ssh_path_prefix
user_host
=
"
#{
gitlab_shell
.
ssh_user
}
@
#{
gitlab_shell
.
ssh_host
}
"
user_host
=
"
#{
gitlab_shell
.
ssh_user
}
@
#{
gitlab_shell
.
ssh_host
}
"
...
@@ -42,11 +46,11 @@ class Settings < Settingslogic
...
@@ -42,11 +46,11 @@ class Settings < Settingslogic
end
end
def
build_base_gitlab_url
def
build_base_gitlab_url
base_
gitlab_url
.
join
(
''
)
base_
url
(
gitlab
)
.
join
(
''
)
end
end
def
build_gitlab_url
def
build_gitlab_url
(
base_
gitlab_url
+
[
gitlab
.
relative_url_root
]).
join
(
''
)
(
base_
url
(
gitlab
)
+
[
gitlab
.
relative_url_root
]).
join
(
''
)
end
end
# check that values in `current` (string or integer) is a contant in `modul`.
# check that values in `current` (string or integer) is a contant in `modul`.
...
@@ -74,11 +78,11 @@ class Settings < Settingslogic
...
@@ -74,11 +78,11 @@ class Settings < Settingslogic
private
private
def
base_
gitlab_url
def
base_
url
(
config
)
custom_port
=
gitlab_on_standard_port?
?
nil
:
":
#{
gitlab
.
port
}
"
custom_port
=
on_standard_port?
(
config
)
?
nil
:
":
#{
config
.
port
}
"
[
gitlab
.
protocol
,
[
config
.
protocol
,
"://"
,
"://"
,
gitlab
.
host
,
config
.
host
,
custom_port
custom_port
]
]
end
end
...
@@ -254,11 +258,17 @@ Settings.registry['issuer'] ||= nil
...
@@ -254,11 +258,17 @@ Settings.registry['issuer'] ||= nil
Settings
.
registry
[
'host_port'
]
||=
[
Settings
.
registry
[
'host'
],
Settings
.
registry
[
'port'
]].
compact
.
join
(
':'
)
Settings
.
registry
[
'host_port'
]
||=
[
Settings
.
registry
[
'host'
],
Settings
.
registry
[
'port'
]].
compact
.
join
(
':'
)
Settings
.
registry
[
'path'
]
=
File
.
expand_path
(
Settings
.
registry
[
'path'
]
||
File
.
join
(
Settings
.
shared
[
'path'
],
'registry'
),
Rails
.
root
)
Settings
.
registry
[
'path'
]
=
File
.
expand_path
(
Settings
.
registry
[
'path'
]
||
File
.
join
(
Settings
.
shared
[
'path'
],
'registry'
),
Rails
.
root
)
#
# Pages
# Pages
#
Settings
[
'pages'
]
||=
Settingslogic
.
new
({})
Settings
[
'pages'
]
||=
Settingslogic
.
new
({})
Settings
.
pages
[
'enabled'
]
=
false
if
Settings
.
pages
[
'enabled'
].
nil?
Settings
.
pages
[
'enabled'
]
=
false
if
Settings
.
pages
[
'enabled'
].
nil?
Settings
.
pages
[
'path'
]
=
File
.
expand_path
(
'shared/pages/'
,
Rails
.
root
)
Settings
.
pages
[
'path'
]
=
File
.
expand_path
(
'shared/pages/'
,
Rails
.
root
)
Settings
.
pages
[
'domain'
]
||=
"example.com"
Settings
.
pages
[
'domain'
]
||=
"example.com"
Settings
.
pages
[
'https'
]
=
false
if
Settings
.
pages
[
'https'
].
nil?
Settings
.
pages
[
'port'
]
||=
Settings
.
pages
.
https
?
443
:
80
Settings
.
pages
[
'protocol'
]
||=
Settings
.
pages
.
https
?
"https"
:
"http"
Settings
.
pages
[
'url'
]
||=
Settings
.
send
(
:build_pages_url
)
#
#
# Git LFS
# Git LFS
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment