Skip to content

Commit

Permalink
Suppress 'config' package's warnings when config file is missing. (#606)
Browse files Browse the repository at this point in the history
Fixes #480.

It's confusing people and we don't really use this package properly
or rely on it for this anyways.
  • Loading branch information
Gnuxie authored Oct 9, 2024
1 parent 4015543 commit cb2ad99
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
import * as fs from "fs";
import { load } from "js-yaml";
import { LogService, RichConsoleLogger } from "matrix-bot-sdk";
// Needed for https://github.com/the-draupnir-project/Draupnir/issues/480
// sorry buddy...
process.env.SUPPRESS_NO_CONFIG_WARNING = "y";
import Config from "config";
import path from "path";
import { SafeModeBootOption } from "./safemode/BootOption";
Expand Down Expand Up @@ -286,7 +289,9 @@ function getConfigPath(): {
}
const path = Config.util.getConfigSources().at(-1)?.name;
if (path === undefined) {
throw new TypeError("No configuration path has been found for Draupnir");
throw new TypeError(
"No configuration path has been found for Draupnir. Use the --draupnir-config option to provide a path to the config."
);
}
return { isDraupnirPath: false, path };
}
Expand Down

0 comments on commit cb2ad99

Please sign in to comment.