mirror of https://github.com/coder/code-server.git
Remove cliArgs from main
No purpose when all the args are in the args parameter. We only need configArgs for bindAddrFromAllSources.
This commit is contained in:
parent
ebbcb8d6a7
commit
85b0804be5
|
@ -58,7 +58,6 @@ EOF
|
|||
rsync yarn.lock "$RELEASE_PATH"
|
||||
rsync ci/build/npm-postinstall.sh "$RELEASE_PATH/postinstall.sh"
|
||||
|
||||
|
||||
if [ "$KEEP_MODULES" = 1 ]; then
|
||||
rsync node_modules/ "$RELEASE_PATH/node_modules"
|
||||
fi
|
||||
|
|
|
@ -35,11 +35,11 @@ try {
|
|||
const version = pkg.version || "development"
|
||||
const commit = pkg.commit || "development"
|
||||
|
||||
const main = async (args: Args, cliArgs: Args, configArgs: Args): Promise<void> => {
|
||||
const main = async (args: Args, configArgs: Args): Promise<void> => {
|
||||
if (args["coder-bind"]) {
|
||||
// If we're being exposed to the cloud, we listen on a random address and disable auth.
|
||||
cliArgs = {
|
||||
...cliArgs,
|
||||
args = {
|
||||
...args,
|
||||
host: "localhost",
|
||||
port: 0,
|
||||
auth: AuthType.None,
|
||||
|
@ -64,7 +64,7 @@ const main = async (args: Args, cliArgs: Args, configArgs: Args): Promise<void>
|
|||
if (args.auth === AuthType.Password && !password) {
|
||||
throw new Error("Please pass in a password via the config file or $PASSWORD")
|
||||
}
|
||||
const [host, port] = bindAddrFromAllSources(cliArgs, configArgs)
|
||||
const [host, port] = bindAddrFromAllSources(args, configArgs)
|
||||
|
||||
// Spawn the main HTTP server.
|
||||
const options: HttpServerOptions = {
|
||||
|
@ -153,21 +153,21 @@ const main = async (args: Args, cliArgs: Args, configArgs: Args): Promise<void>
|
|||
}
|
||||
|
||||
async function entry(): Promise<void> {
|
||||
const tryParse = async (): Promise<[Args, Args, Args]> => {
|
||||
const tryParse = async (): Promise<[Args, Args]> => {
|
||||
try {
|
||||
const cliArgs = parse(process.argv.slice(2))
|
||||
const configArgs = await readConfigFile(cliArgs.config)
|
||||
// This prioritizes the flags set in args over the ones in the config file.
|
||||
let args = Object.assign(configArgs, cliArgs)
|
||||
args = await setDefaults(args)
|
||||
return [args, cliArgs, configArgs]
|
||||
return [args, configArgs]
|
||||
} catch (error) {
|
||||
console.error(error.message)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
const [args, cliArgs, configArgs] = await tryParse()
|
||||
const [args, configArgs] = await tryParse()
|
||||
if (args.help) {
|
||||
console.log("code-server", version, commit)
|
||||
console.log("")
|
||||
|
@ -262,7 +262,7 @@ async function entry(): Promise<void> {
|
|||
vscode.write(JSON.stringify(pipeArgs))
|
||||
vscode.end()
|
||||
} else {
|
||||
wrap(() => main(args, cliArgs, configArgs))
|
||||
wrap(() => main(args, configArgs))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue