Skip to content

Commit

Permalink
fix: .env snowflake parsing (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
jejebecarte authored Sep 2, 2024
1 parent 7e8b80a commit 8184f59
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
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

0 comments on commit 8184f59

Please sign in to comment.