Skip to content

Commit

Permalink
fix(frontend): move BASE_TIMEZONE to client config (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregory-j-baker authored Mar 5, 2025
1 parent b0bd270 commit 44e0621
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 3 additions & 0 deletions frontend/app/.server/environment/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import * as v from 'valibot';

import { stringToBooleanSchema } from '~/.server/validation/string-to-boolean-schema';
import { stringToIntegerSchema } from '~/.server/validation/string-to-integer-schema';
import { isValidTimeZone } from '~/utils/date-utils';

export type Client = Readonly<v.InferOutput<typeof client>>;

export const defaults = {
BASE_TIMEZONE: 'Canada/Eastern',
BUILD_DATE: '1970-01-01T00:00:00.000Z',
BUILD_ID: '000000',
BUILD_REVISION: '00000000',
Expand All @@ -22,6 +24,7 @@ export const defaults = {
* ⚠️ IMPORTANT: DO NOT PUT SENSITIVE CONFIGURATIONS HERE ⚠️
*/
export const client = v.object({
BASE_TIMEZONE: v.optional(v.pipe(v.string(), v.check(isValidTimeZone)), defaults.BASE_TIMEZONE),
BUILD_DATE: v.optional(v.string(), defaults.BUILD_DATE),
BUILD_ID: v.optional(v.string(), defaults.BUILD_ID),
BUILD_REVISION: v.optional(v.string(), defaults.BUILD_REVISION),
Expand Down
3 changes: 0 additions & 3 deletions frontend/app/.server/environment/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ import { session, defaults as sessionDefaults } from '~/.server/environment/sess
import { telemetry, defaults as telemetryDefaults } from '~/.server/environment/telemetry';
import { LogFactory } from '~/.server/logging';
import { stringToIntegerSchema } from '~/.server/validation/string-to-integer-schema';
import { isValidTimeZone } from '~/utils/date-utils';

const log = LogFactory.getLogger(import.meta.url);

export type Server = Readonly<v.InferOutput<typeof server>>;

export const defaults = {
BASE_TIMEZONE: 'Canada/Eastern',
NODE_ENV: 'development',
PORT: '3000',
...authenticationDefaults,
Expand All @@ -41,7 +39,6 @@ export const server = v.pipe(
...redis.entries,
...session.entries,
...telemetry.entries,
BASE_TIMEZONE: v.optional(v.pipe(v.string(), v.check(isValidTimeZone)), defaults.BASE_TIMEZONE),
NODE_ENV: v.optional(v.picklist(['production', 'development', 'test']), defaults.NODE_ENV),
PORT: v.optional(v.pipe(stringToIntegerSchema(), v.minValue(0)), defaults.PORT),
}),
Expand Down

0 comments on commit 44e0621

Please sign in to comment.