chore: output resolved path in CLI when config couldn't be read (#518)

This commit is contained in:
Jonathan Wilke
2024-11-13 20:24:20 +01:00
committed by GitHub
parent c322fb2fc8
commit c2d42bb61d

View File

@@ -99,6 +99,7 @@ export async function getConfig({
try {
let configFile: BetterAuthOptions | null = null;
if (configPath) {
const resolvedPath = path.join(cwd, configPath);
const { config } = await loadConfig<{
auth: {
options: BetterAuthOptions;
@@ -107,13 +108,13 @@ export async function getConfig({
options: BetterAuthOptions;
};
}>({
configFile: path.join(cwd, configPath),
configFile: resolvedPath,
dotenv: true,
jitiOptions: jitiOptions(cwd),
});
if (!config.auth && !config.default) {
logger.error(
"[#better-auth]: Couldn't read your auth config. Make sure to default export your auth instance or to export as a variable named auth.",
`[#better-auth]: Couldn't read your auth config in ${resolvedPath}. Make sure to default export your auth instance or to export as a variable named auth.`,
);
process.exit(1);
}