Finish removing server-secrets.js (#5664)
I’ve tested locally that setting `gh_token` still conditionally enables `ConditionalGithubAuthV3Service`. Closes #3393
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
const gql = require('graphql-tag')
|
||||
const { mergeQueries } = require('../../core/base-service/graphql')
|
||||
const { BaseGraphqlService, BaseJsonService } = require('..')
|
||||
const { staticAuthConfigured } = require('./github-helpers')
|
||||
|
||||
function createRequestFetcher(context, config) {
|
||||
const { sendAndCacheRequestWithCallbacks, githubApiProvider } = context
|
||||
@@ -32,7 +31,7 @@ class GithubAuthV3Service extends BaseJsonService {
|
||||
class ConditionalGithubAuthV3Service extends BaseJsonService {
|
||||
constructor(context, config) {
|
||||
super(context, config)
|
||||
if (staticAuthConfigured()) {
|
||||
if (context.githubApiProvider.globalToken) {
|
||||
this._requestFetcher = createRequestFetcher(context, config)
|
||||
this.staticAuthConfigured = true
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
'use strict'
|
||||
|
||||
const serverSecrets = require('../../lib/server-secrets')
|
||||
const { colorScale } = require('../color-formatters')
|
||||
const { InvalidResponse, NotFound } = require('..')
|
||||
|
||||
@@ -34,15 +33,10 @@ function transformErrors(errors, entity = 'repo') {
|
||||
|
||||
const commentsColor = colorScale([1, 3, 10, 25], undefined, true)
|
||||
|
||||
function staticAuthConfigured() {
|
||||
return Boolean(serverSecrets.gh_token)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
documentation,
|
||||
stateColor,
|
||||
commentsColor,
|
||||
errorMessagesFor,
|
||||
transformErrors,
|
||||
staticAuthConfigured,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user