summaryrefslogtreecommitdiff
path: root/app/services
diff options
context:
space:
mode:
authorRob Watson <rob@mixlr.com>2018-01-03 08:07:03 +0000
committerRob Watson <rob@mixlr.com>2018-03-22 19:58:36 +0100
commit9d45951fcaeda4f01a2e4be2480d980a3e7cd37e (patch)
tree536b456729edad79ba718d987a39f235587d4dfb /app/services
parent53d352aaf4ce7f0d2bcaf04cce5252b753ef7938 (diff)
downloadgitlab-ce-9d45951fcaeda4f01a2e4be2480d980a3e7cd37e.tar.gz
Add HTTPS-only pages
Closes #28857
Diffstat (limited to 'app/services')
-rw-r--r--app/services/projects/update_pages_configuration_service.rb6
-rw-r--r--app/services/projects/update_service.rb10
2 files changed, 14 insertions, 2 deletions
diff --git a/app/services/projects/update_pages_configuration_service.rb b/app/services/projects/update_pages_configuration_service.rb
index 52ff64cc938..25017c5cbe3 100644
--- a/app/services/projects/update_pages_configuration_service.rb
+++ b/app/services/projects/update_pages_configuration_service.rb
@@ -18,7 +18,8 @@ module Projects
def pages_config
{
- domains: pages_domains_config
+ domains: pages_domains_config,
+ https_only: project.pages_https_only?
}
end
@@ -27,7 +28,8 @@ module Projects
{
domain: domain.domain,
certificate: domain.certificate,
- key: domain.key
+ key: domain.key,
+ https_only: project.pages_https_only? && domain.https?
}
end
end
diff --git a/app/services/projects/update_service.rb b/app/services/projects/update_service.rb
index 5f2615a2c01..679f4a9cb62 100644
--- a/app/services/projects/update_service.rb
+++ b/app/services/projects/update_service.rb
@@ -24,6 +24,8 @@ module Projects
system_hook_service.execute_hooks_for(project, :update)
end
+ update_pages_config if changing_pages_https_only?
+
success
else
model_errors = project.errors.full_messages.to_sentence
@@ -67,5 +69,13 @@ module Projects
log_error("Could not create wiki for #{project.full_name}")
Gitlab::Metrics.counter(:wiki_can_not_be_created_total, 'Counts the times we failed to create a wiki')
end
+
+ def update_pages_config
+ Projects::UpdatePagesConfigurationService.new(project).execute
+ end
+
+ def changing_pages_https_only?
+ project.previous_changes.include?(:pages_https_only)
+ end
end
end