Use fs to read github auth config file

This commit is contained in:
Rachel Macfarlane 2020-03-13 09:24:29 -07:00
parent 38a80a3038
commit d21cadb83f
2 changed files with 8 additions and 3 deletions

View file

@ -20,7 +20,9 @@ function main() {
}
}
fs.writeFileSync(path.join(__dirname, '../src/common/config.json'), JSON.stringify(content));
if (Object.keys(content).length > 0) {
fs.writeFileSync(path.join(__dirname, '../src/common/config.json'), JSON.stringify(content));
}
}
main();

View file

@ -3,7 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Uri } from 'vscode';
import { Uri, env } from 'vscode';
import * as fs from 'fs';
import * as path from 'path';
export interface ClientDetails {
id?: string;
@ -26,7 +28,8 @@ export class Registrar {
constructor() {
try {
this._config = require('./config.json') as ClientConfig;
const fileContents = fs.readFileSync(path.join(env.appRoot, 'extensions/github-authentication/src/common/config.json')).toString();
this._config = JSON.parse(fileContents);
} catch (e) {
this._config = {
OSS: {},