Use .lounge_config to help distribution packages handle config paths right
This commit is contained in:
parent
28e32dc558
commit
5299d976c0
1
.lounge_config
Normal file
1
.lounge_config
Normal file
@ -0,0 +1 @@
|
||||
~/.lounge
|
@ -13,7 +13,25 @@ program.version(Helper.getVersion(), "-v, --version")
|
||||
.option("--home <path>", "path to configuration folder")
|
||||
.parseOptions(process.argv);
|
||||
|
||||
Helper.setHome(program.home || process.env.LOUNGE_HOME);
|
||||
if (program.home) {
|
||||
log.warn(`${colors.green("--home")} is deprecated and will be removed in a future version.`);
|
||||
log.warn(`Use ${colors.green("LOUNGE_HOME")} environment variable instead.`);
|
||||
}
|
||||
|
||||
let home = program.home || process.env.LOUNGE_HOME;
|
||||
|
||||
if (!home) {
|
||||
const distConfig = path.resolve(path.join(
|
||||
__dirname,
|
||||
"..",
|
||||
"..",
|
||||
".lounge_config"
|
||||
));
|
||||
|
||||
home = fs.readFileSync(distConfig, "utf-8").trim();
|
||||
}
|
||||
|
||||
Helper.setHome(home);
|
||||
|
||||
if (!fs.existsSync(Helper.CONFIG_PATH)) {
|
||||
fsextra.ensureDirSync(Helper.HOME);
|
||||
|
@ -60,7 +60,7 @@ function getGitCommit() {
|
||||
}
|
||||
|
||||
function setHome(homePath) {
|
||||
this.HOME = expandHome(homePath || "~/.lounge");
|
||||
this.HOME = expandHome(homePath);
|
||||
this.CONFIG_PATH = path.join(this.HOME, "config.js");
|
||||
this.USERS_PATH = path.join(this.HOME, "users");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user