add twilio config
use app version in config
This commit is contained in:
parent
ae9231d816
commit
728ea32c16
4 changed files with 39 additions and 4 deletions
|
|
@ -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
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
|||
27
src/lib/server/twilio/twilio.config.ts
Normal file
27
src/lib/server/twilio/twilio.config.ts
Normal file
|
|
@ -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();
|
||||
Loading…
Add table
Add a link
Reference in a new issue