Enable GraphQL API endpoint
This commit is contained in:
parent
2bb468d6b9
commit
744f6ed12b
5 changed files with 11 additions and 7 deletions
|
@ -43,6 +43,6 @@ class GraphqlController < ApplicationController
|
|||
end
|
||||
|
||||
def check_graphql_feature_flag!
|
||||
render_404 unless Feature.enabled?(:graphql, default_enabled: true)
|
||||
render_404 unless Gitlab::Graphql.enabled?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
= render 'shared/issuable/form/template_selector', issuable: issuable
|
||||
= render 'shared/issuable/form/title', issuable: issuable, form: form, has_wip_commits: commits && commits.detect(&:work_in_progress?)
|
||||
- if Feature.enabled?(:graphql, default_enabled: true)
|
||||
- if Gitlab::Graphql.enabled?
|
||||
#js-suggestions{ data: { project_path: @project.full_path } }
|
||||
|
||||
= render 'shared/form_elements/description', model: issuable, form: form, project: project
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
constraints(::Constraints::FeatureConstrainer.new(:graphql)) do
|
||||
constraints(::Constraints::FeatureConstrainer.new(:graphql, nil, true)) do
|
||||
post '/api/graphql', to: 'graphql#execute'
|
||||
mount GraphiQL::Rails::Engine, at: '/-/graphql-explorer', graphql_path: '/api/graphql'
|
||||
end
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
module Constraints
|
||||
class FeatureConstrainer
|
||||
attr_reader :feature
|
||||
attr_reader :feature, :thing, :default_enabled
|
||||
|
||||
def initialize(feature)
|
||||
@feature = feature
|
||||
def initialize(feature, thing, default_enabled)
|
||||
@feature, @thing, @default_enabled = feature, thing, default_enabled
|
||||
end
|
||||
|
||||
def matches?(_request)
|
||||
Feature.enabled?(feature)
|
||||
Feature.enabled?(feature, @thing, default_enabled: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,5 +3,9 @@
|
|||
module Gitlab
|
||||
module Graphql
|
||||
StandardGraphqlError = Class.new(StandardError)
|
||||
|
||||
def self.enabled?
|
||||
Feature.enabled?(:graphql, default_enabled: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue