Skip to content

Commit

Permalink
Now conditionally loading the appropriate GitHub/GHES GraphQL client …
Browse files Browse the repository at this point in the history
…depending on the variant
  • Loading branch information
johntopleyons committed Sep 6, 2024
1 parent a66d2b2 commit 6eb6e50
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion webapp/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

require_relative 'lib/configuration'
require_relative 'lib/firestore_client'
require_relative 'lib/github'
require_relative 'lib/github_error'

include Pagy::Backend # rubocop:disable Style/MixinUsage
Expand All @@ -20,6 +19,12 @@

set :logging, false # Stop Sinatra logging routes to STDERR.

if CONFIG.github?
require_relative 'lib/github/graphql_client'
elsif CONFIG.github_enterprise_server?
# require_relative 'lib/github_enterprise_server/graphql_client'
end

before do
image_sources = CONFIG.content_security_policy_image_sources
script_sources = CONFIG.content_security_policy_script_sources
Expand All @@ -40,6 +45,11 @@
@organisations = CONFIG.github_organisations.split(',')
@selected_organisation = cookies['github-explorer-organisation'] || @organisations.first
@firestore = FirestoreClient.new(CONFIG.firestore_project, @selected_organisation)

if CONFIG.github?
@github = GitHub.new(CONFIG.github_enterprise, @selected_organisation,
CONFIG.github_api_base_uri, CONFIG.github_token)
end
end

get '/?' do
Expand Down

0 comments on commit 6eb6e50

Please sign in to comment.