diff --git a/.env b/.env index ac58967..0b3747e 100644 --- a/.env +++ b/.env @@ -1,2 +1,6 @@ -VITE_APP_VERSION=1.0.0-alpha -DATABASE_URL="postgres://hestia:test123@localhost:5432/hestia" +# TWILIO +VITE_TWILIO_ACCOUNT_SID= +VITE_TWILIO_AUTH_TOKEN= + +# PRISMA +DATABASE_URL="file:./dev.db" diff --git a/src/lib/server/pothos/schema/index.ts b/src/lib/server/pothos/schema/index.ts index 84e199f..9f8978e 100644 --- a/src/lib/server/pothos/schema/index.ts +++ b/src/lib/server/pothos/schema/index.ts @@ -1,3 +1,4 @@ +import { version } from '$app/environment'; import { builder } from '../builder'; builder.queryType({}); @@ -5,7 +6,7 @@ builder.queryType({}); builder.queryField('version', (t) => t.string({ description: 'Application version', - resolve: (parent, args, context) => context.config.app_version, + resolve: () => version }) ); diff --git a/src/lib/server/twilio/twilio.config.ts b/src/lib/server/twilio/twilio.config.ts new file mode 100644 index 0000000..8347082 --- /dev/null +++ b/src/lib/server/twilio/twilio.config.ts @@ -0,0 +1,27 @@ +import { logger } from '$lib/server/logger'; +import { z } from 'zod'; + +export interface TwilioConfiguration { + twilio_account_sid: string; + twilio_auth_token: string; +} + +const LoadConfig = (): TwilioConfiguration => { + const { success, data, error } = z + .object({ + VITE_TWILIO_ACCOUNT_SID: z.string(), + VITE_TWILIO_AUTH_TOKEN: z.string() + }) + .safeParse(import.meta.env); + + if (!success) { + logger.error(error.message); + } + + return { + twilio_account_sid: data!.VITE_TWILIO_ACCOUNT_SID, + twilio_auth_token: data!.VITE_TWILIO_AUTH_TOKEN + }; +}; + +export const TwilioConfig = LoadConfig(); \ No newline at end of file diff --git a/svelte.config.js b/svelte.config.js index 3ad145a..beb7e05 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -8,6 +8,9 @@ const config = { preprocess: vitePreprocess(), kit: { + version: { + name: '1.0.0-alpha' + }, // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list. // If your environment is not supported, or you settled on a specific environment, switch out the adapter. // See https://svelte.dev/docs/kit/adapters for more information about adapters. @@ -15,4 +18,4 @@ const config = { }, }; -export default config; +export default config; \ No newline at end of file