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