fix: make env dynamic
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { Configuration, OpenAIApi } from 'openai-edge';
|
||||
import { OpenAIStream, StreamingTextResponse } from 'ai';
|
||||
import { OPENAI_API_KEY } from '$env/static/private';
|
||||
import { env } from '$env/dynamic/private';
|
||||
|
||||
// Create an OpenAI API client (that's edge friendly!)
|
||||
const openAIConfig = new Configuration({
|
||||
apiKey: OPENAI_API_KEY
|
||||
apiKey: env.OPENAI_API_KEY
|
||||
});
|
||||
const openai = new OpenAIApi(openAIConfig);
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { OPENAI_API_KEY } from '$env/static/private';
|
||||
import { env } from '$env/dynamic/private';
|
||||
import { OpenAIStream, StreamingTextResponse } from 'ai';
|
||||
import { Configuration, OpenAIApi } from 'openai-edge';
|
||||
|
||||
// Create an OpenAI API client (that's edge friendly!)
|
||||
const openAIConfig = new Configuration({
|
||||
apiKey: OPENAI_API_KEY
|
||||
apiKey: env.OPENAI_API_KEY
|
||||
});
|
||||
const openai = new OpenAIApi(openAIConfig);
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Configuration, OpenAIApi } from 'openai-edge';
|
||||
import { OpenAIStream, StreamingTextResponse } from 'ai';
|
||||
import { OPENAI_API_KEY } from '$env/static/private';
|
||||
import { env } from '$env/dynamic/private';
|
||||
|
||||
// Create an OpenAI API client (that's edge friendly!)
|
||||
const openAIConfig = new Configuration({
|
||||
apiKey: OPENAI_API_KEY
|
||||
apiKey: env.OPENAI_API_KEY
|
||||
});
|
||||
const openai = new OpenAIApi(openAIConfig);
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { OPENAI_API_KEY } from '$env/static/private';
|
||||
import { env } from '$env/dynamic/private';
|
||||
import { OpenAIStream, StreamingTextResponse } from 'ai';
|
||||
import { Configuration, OpenAIApi } from 'openai-edge';
|
||||
|
||||
// Create an OpenAI API client (that's edge friendly!)
|
||||
const openAIConfig = new Configuration({
|
||||
apiKey: OPENAI_API_KEY
|
||||
apiKey: env.OPENAI_API_KEY
|
||||
});
|
||||
const openai = new OpenAIApi(openAIConfig);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import { createCheckout } from '@lemonsqueezy/lemonsqueezy.js';
|
||||
import { LEMON_SQUEEZY_STORE_ID } from '$env/static/private';
|
||||
import { env } from '$env/dynamic/private';
|
||||
import { configureLemonSqueezy } from '$lib/utils/services/lemonsqueezy';
|
||||
|
||||
export async function POST({ request }) {
|
||||
@@ -23,7 +23,7 @@ export async function POST({ request }) {
|
||||
|
||||
console.log({ checkoutData });
|
||||
|
||||
const { data } = await createCheckout(LEMON_SQUEEZY_STORE_ID, productId, {
|
||||
const { data } = await createCheckout(env.LEMON_SQUEEZY_STORE_ID, productId, {
|
||||
checkoutData
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import crypto from 'crypto';
|
||||
import { LEMON_SQUEEZY_WEBHOOK_SECRET } from '$env/static/private';
|
||||
import { env } from '$env/dynamic/private';
|
||||
import { createOrgPlan, cancelOrgPlan } from '$lib/utils/services/org';
|
||||
import { PLAN } from 'shared/src/plans/constants';
|
||||
import { getServerSupabase } from '$lib/utils/functions/supabase.server';
|
||||
@@ -15,7 +15,7 @@ export async function POST({ request }) {
|
||||
const body = await request.json();
|
||||
|
||||
// Check signature
|
||||
const secret = LEMON_SQUEEZY_WEBHOOK_SECRET;
|
||||
const secret = env.LEMON_SQUEEZY_WEBHOOK_SECRET;
|
||||
const hmac = crypto.createHmac('sha256', secret);
|
||||
const digest = Buffer.from(hmac.update(await clonedReq.text()).digest('hex'), 'utf8');
|
||||
const signature = Buffer.from(request.headers.get('X-Signature') || '', 'utf8');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { json } from '@sveltejs/kit';
|
||||
import { UNSPLASH_API_KEY } from '$env/static/private';
|
||||
import { env } from '$env/dynamic/private';
|
||||
|
||||
const UNSPLASH_API_URL = `https://api.unsplash.com/search/photos?page=2&per_page=15&auto=format&fit=crop&w=2970&q=80&client_id=${UNSPLASH_API_KEY}`;
|
||||
const UNSPLASH_API_URL = `https://api.unsplash.com/search/photos?page=2&per_page=15&auto=format&fit=crop&w=2970&q=80&client_id=${env.UNSPLASH_API_KEY}`;
|
||||
|
||||
// API to fetch photos from Unsplash
|
||||
export async function POST({ request }) {
|
||||
|
||||
Reference in New Issue
Block a user