File tree Expand file tree Collapse file tree
packages/apollo-language-server/src/config Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919- ` apollo-graphql `
2020 - <First ` apollo-graphql ` related entry goes here>
2121- ` apollo-language-server `
22+ - Remove error from the case with old and new api keys present [ #1893 ] ( https://github.com/apollographql/apollo-tooling/pull/1893 )
2223 - Add Elixir support for vscode [ #1971 ] ( https://github.com/apollographql/apollo-tooling/pull/1971 )
2324- ` apollo-tools `
2425 - <First ` apollo-tools ` related entry goes here>
Original file line number Diff line number Diff line change @@ -339,18 +339,22 @@ describe("loadConfig", () => {
339339 ) ;
340340 } ) ;
341341
342- it ( "Throws when .env defined legacy and new key" , async ( ) => {
342+ it ( "Uses new key when .env defined both legacy and new key" , async ( ) => {
343343 writeFilesToDir ( dir , {
344344 "my.config.js" : `module.exports = { client: { name: 'hello' } }` ,
345345 ".env.local" : `ENGINE_API_KEY=service:yoshi:65489061ko\nAPOLLO_KEY=service:yoshi:65489061ko`
346346 } ) ;
347+ const spy = jest . spyOn ( Debug , "warning" ) ;
347348
348- const loadConfigPromise = loadConfig ( {
349+ const config = await loadConfig ( {
349350 configPath : dirPath ,
350351 configFileName : "my.config.js"
351352 } ) ;
352353
353- await expect ( loadConfigPromise ) . rejects . toThrow ( / C a n n o t s e t b o t h / ) ;
354+ expect ( config . engine . apiKey ) . toEqual ( "service:yoshi:65489061ko" ) ;
355+ expect ( spy ) . toHaveBeenCalledWith (
356+ expect . stringMatching ( / B o t h E N G I N E _ A P I _ K E Y a n d A P O L L O _ K E Y w e r e f o u n d / i)
357+ ) ;
354358 } ) ;
355359
356360 // this doesn't work right now :)
Original file line number Diff line number Diff line change @@ -129,8 +129,8 @@ export async function loadConfig({
129129 const legacyKey = env [ legacyKeyEnvVar ] ;
130130 const key = env [ keyEnvVar ] ;
131131 if ( legacyKey && key ) {
132- throw new Error (
133- `Cannot set both ${ legacyKeyEnvVar } and ${ keyEnvVar } . Please only set ${ keyEnvVar } `
132+ Debug . warning (
133+ `Both ${ legacyKeyEnvVar } and ${ keyEnvVar } were found. ${ keyEnvVar } will take precedence. `
134134 ) ;
135135 }
136136 if ( legacyKey ) {
You can’t perform that action at this time.
0 commit comments