Add default config file and improve config/data directory detection

This commit is contained in:
Anmol Sethi
2020-05-10 01:35:42 -04:00
parent c5179c2a06
commit 00d164b67f
9 changed files with 77 additions and 38 deletions

View File

@ -11,7 +11,7 @@ import { UpdateHttpProvider } from "./app/update"
import { VscodeHttpProvider } from "./app/vscode"
import { Args, optionDescriptions, parse, readConfigFile } from "./cli"
import { AuthType, HttpServer, HttpServerOptions } from "./http"
import { generateCertificate, generatePassword, hash, open } from "./util"
import { generateCertificate, generatePassword, hash, open, uxPath } from "./util"
import { ipcMain, wrap } from "./wrapper"
process.on("uncaughtException", (error) => {
@ -34,6 +34,11 @@ const commit = pkg.commit || "development"
const main = async (args: Args): Promise<void> => {
args = await readConfigFile(args)
if (args.verbose === true) {
logger.info(`Using extensions-dir at ${uxPath(args["extensions-dir"]!)}`)
logger.info(`Using user-data-dir at ${uxPath(args["user-data-dir"]!)}`)
}
const auth = args.auth || AuthType.Password
const originalPassword = auth === AuthType.Password && (process.env.PASSWORD || (await generatePassword()))