Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: .env snowflake parsing #219

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ REMINDER_FREQUENCY=60
DISCORD_TOKEN=""
DISCORD_IGNORE_PREFIX=")"
DISCORD_INVITE_LINK=""

MEMBER_CHANNEL_ID=
OFFICER_CHANNEL_ID=
BLACKLIST_CHANNEL_ID=
Expand Down
8 changes: 3 additions & 5 deletions src/util/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ import { z } from 'zod';

config();

logger.error(new Error());

const BOOLEAN_SCHEMA = z
.string()
.toLowerCase()
.transform((x) => x === 'true')
.pipe(z.boolean());

const SNOWFLAKE_SCHEMA = z.coerce
.number()
.int()
.positive()
.transform((val) => val.toString());
const SNOWFLAKE_SCHEMA = z.coerce.string().regex(/^\d*$/gm);

const envSchema = z
.object({
Expand Down
9 changes: 6 additions & 3 deletions src/util/recursive-walk-dir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import path from 'path';

/**
*
* @param normalisedDirName The directory to begin walking through. Normalised with path.join().
* @param normalisedDirName The directory to begin walking through, normalised with path.join().
* @param callback The callback to execute for every file found.
* @param errMessage The error message to display if an error occurs during the process.
*/
Expand All @@ -27,8 +27,11 @@ async function recursiveWalkDir(
try {
await Promise.all(promises);
} catch (e: unknown) {
// Change to just err as param?
logger.error(`${errMessage} ${(e as Error).message}`);
logger.error(errMessage);

if (e instanceof Error) {
logger.error(e);
}
}
}

Expand Down