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
8
.env
8
.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"
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
@ -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;
|
||||
Loading…
Add table
Reference in a new issue