diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities.rb | 2 | ||||
-rw-r--r-- | lib/api/pages_domains.rb | 14 | ||||
-rw-r--r-- | lib/api/settings.rb | 5 | ||||
-rw-r--r-- | lib/gitlab/redis/wrapper.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/sourcegraph.rb | 26 |
5 files changed, 44 insertions, 5 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 5aa16b117fd..9617f1a8acf 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -1681,6 +1681,7 @@ module API expose :verified?, as: :verified expose :verification_code, as: :verification_code expose :enabled_until + expose :auto_ssl_enabled expose :certificate, as: :certificate_expiration, @@ -1696,6 +1697,7 @@ module API expose :verified?, as: :verified expose :verification_code, as: :verification_code expose :enabled_until + expose :auto_ssl_enabled expose :certificate, if: ->(pages_domain, _) { pages_domain.certificate? }, diff --git a/lib/api/pages_domains.rb b/lib/api/pages_domains.rb index ec2fe8270b7..2d02a4e624c 100644 --- a/lib/api/pages_domains.rb +++ b/lib/api/pages_domains.rb @@ -92,8 +92,10 @@ module API requires :domain, type: String, desc: 'The domain' # rubocop:disable Scalability/FileUploads # TODO: remove rubocop disable - https://gitlab.com/gitlab-org/gitlab/issues/14960 - optional :certificate, allow_blank: false, types: [File, String], desc: 'The certificate', as: :user_provided_certificate - optional :key, allow_blank: false, types: [File, String], desc: 'The key', as: :user_provided_key + optional :certificate, types: [File, String], desc: 'The certificate', as: :user_provided_certificate + optional :key, types: [File, String], desc: 'The key', as: :user_provided_key + optional :auto_ssl_enabled, allow_blank: false, type: Boolean, default: false, + desc: "Enables automatic generation of SSL certificates issued by Let's Encrypt for custom domains." # rubocop:enable Scalability/FileUploads all_or_none_of :user_provided_certificate, :user_provided_key end @@ -116,14 +118,16 @@ module API requires :domain, type: String, desc: 'The domain' # rubocop:disable Scalability/FileUploads # TODO: remove rubocop disable - https://gitlab.com/gitlab-org/gitlab/issues/14960 - optional :certificate, allow_blank: false, types: [File, String], desc: 'The certificate', as: :user_provided_certificate - optional :key, allow_blank: false, types: [File, String], desc: 'The key', as: :user_provided_key + optional :certificate, types: [File, String], desc: 'The certificate', as: :user_provided_certificate + optional :key, types: [File, String], desc: 'The key', as: :user_provided_key + optional :auto_ssl_enabled, allow_blank: true, type: Boolean, + desc: "Enables automatic generation of SSL certificates issued by Let's Encrypt for custom domains." # rubocop:enable Scalability/FileUploads end put ":id/pages/domains/:domain", requirements: PAGES_DOMAINS_ENDPOINT_REQUIREMENTS do authorize! :update_pages, user_project - pages_domain_params = declared(params, include_parent_namespaces: false) + pages_domain_params = declared(params, include_parent_namespaces: false, include_missing: false) # Remove empty private key if certificate is not empty. if pages_domain_params[:user_provided_certificate] && !pages_domain_params[:user_provided_key] diff --git a/lib/api/settings.rb b/lib/api/settings.rb index 88076614f73..5362b3060c1 100644 --- a/lib/api/settings.rb +++ b/lib/api/settings.rb @@ -136,6 +136,11 @@ module API optional :sign_in_text, type: String, desc: 'The sign in text of the GitLab application' optional :signin_enabled, type: Boolean, desc: 'Flag indicating if password authentication is enabled for the web interface' # support legacy names, can be removed in v5 optional :signup_enabled, type: Boolean, desc: 'Flag indicating if sign up is enabled' + optional :sourcegraph_enabled, type: Boolean, desc: 'Enable Sourcegraph' + optional :sourcegraph_public_only, type: Boolean, desc: 'Only allow public projects to communicate with Sourcegraph' + given sourcegraph_enabled: ->(val) { val } do + requires :sourcegraph_url, type: String, desc: 'The configured Sourcegraph instance URL' + end optional :terminal_max_session_time, type: Integer, desc: 'Maximum time for web terminal websocket connection (in seconds). Set to 0 for unlimited time.' optional :usage_ping_enabled, type: Boolean, desc: 'Every week GitLab will report license usage back to GitLab, Inc.' optional :instance_statistics_visibility_private, type: Boolean, desc: 'When set to `true` Instance statistics will only be available to admins' diff --git a/lib/gitlab/redis/wrapper.rb b/lib/gitlab/redis/wrapper.rb index fa1615a5953..412d00c6939 100644 --- a/lib/gitlab/redis/wrapper.rb +++ b/lib/gitlab/redis/wrapper.rb @@ -25,6 +25,8 @@ module Gitlab if Sidekiq.server? # the pool will be used in a multi-threaded context size += Sidekiq.options[:concurrency] + elsif defined?(::Puma) + size += Puma.cli_config.options[:max_threads] end size diff --git a/lib/gitlab/sourcegraph.rb b/lib/gitlab/sourcegraph.rb new file mode 100644 index 00000000000..d0f12c8364a --- /dev/null +++ b/lib/gitlab/sourcegraph.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +module Gitlab + class Sourcegraph + class << self + def feature_conditional? + feature.conditional? + end + + def feature_available? + # The sourcegraph_bundle feature could be conditionally applied, so check if `!off?` + !feature.off? + end + + def feature_enabled?(thing = nil) + feature.enabled?(thing) + end + + private + + def feature + Feature.get(:sourcegraph) + end + end + end +end |