Merge pull request #1733 from thelounge/astorije/home_option_env_var

Remove deprecated support for the `--home` option and `$LOUNGE_HOME` environment variable
This commit is contained in:
Pavel Djundik 2018-02-19 18:51:44 +02:00 committed by GitHub
commit a09b21decd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,6 @@ const Helper = require("../helper");
const Utils = require("./utils");
program.version(Helper.getVersion(), "-v, --version")
.option("--home <path>", `${colors.bold.red("[DEPRECATED]")} Use the ${colors.green("THELOUNGE_HOME")} environment variable instead.`)
.option(
"-c, --config <key=value>",
"override entries of the configuration file, must be specified for each entry that needs to be overriden",
@ -22,10 +21,6 @@ program.version(Helper.getVersion(), "-v, --version")
// Parse options from `argv` returning `argv` void of these options.
const argvWithoutOptions = program.parseOptions(process.argv);
if (program.home) {
log.warn(`${colors.bold("--home")} is ${colors.bold.red("deprecated")} and will be removed in The Lounge v3. Use the ${colors.bold("THELOUNGE_HOME")} environment variable instead.`);
}
// Check if the app was built before calling setHome as it wants to load manifest.json from the public folder
if (!fs.existsSync(path.join(
__dirname,
@ -38,18 +33,7 @@ if (!fs.existsSync(path.join(
process.exit(1);
}
if (process.env.LOUNGE_HOME) {
log.warn(`${colors.green("LOUNGE_HOME")} is ${colors.bold.red("deprecated")} and will be removed in The Lounge v3.`);
log.warn(`Use ${colors.green("THELOUNGE_HOME")} instead.`);
}
let home = process.env.THELOUNGE_HOME || program.home || process.env.LOUNGE_HOME;
if (!home) {
home = Utils.defaultHome();
}
Helper.setHome(home);
Helper.setHome(process.env.THELOUNGE_HOME || Utils.defaultHome());
// Merge config key-values passed as CLI options into the main config
_.merge(Helper.config, program.config);