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:
Paul Melnikow
2020-10-07 17:29:03 -04:00
committed by GitHub
parent 3a23695f89
commit e1ac63d3be
4 changed files with 7 additions and 24 deletions

View File

@@ -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 {

View File

@@ -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,
}