mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
Remove process.env (#854)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { type NextRequest, NextResponse } from 'next/server'
|
||||
import { z } from 'zod'
|
||||
import { env } from '@/lib/env'
|
||||
import { createLogger } from '@/lib/logs/console/logger'
|
||||
import { getRedisClient } from '@/lib/redis'
|
||||
import { copilotToolRegistry } from '../tools/registry'
|
||||
@@ -233,7 +234,7 @@ const MethodExecutionSchema = z.object({
|
||||
// Simple internal API key authentication
|
||||
function checkInternalApiKey(req: NextRequest) {
|
||||
const apiKey = req.headers.get('x-api-key')
|
||||
const expectedApiKey = process.env.INTERNAL_API_SECRET
|
||||
const expectedApiKey = env.INTERNAL_API_SECRET
|
||||
|
||||
if (!expectedApiKey) {
|
||||
return { success: false, error: 'Internal API key not configured' }
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { env } from '@/lib/env'
|
||||
import { createLogger } from '@/lib/logs/console/logger'
|
||||
import { executeTool } from '@/tools'
|
||||
import { BaseCopilotTool } from '../base'
|
||||
@@ -49,7 +50,7 @@ async function onlineSearch(params: OnlineSearchParams): Promise<OnlineSearchRes
|
||||
type,
|
||||
gl,
|
||||
hl,
|
||||
apiKey: process.env.SERPER_API_KEY || '',
|
||||
apiKey: env.SERPER_API_KEY || '',
|
||||
}
|
||||
|
||||
const result = await executeTool('serper_search', toolParams)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { env } from '@/lib/env'
|
||||
import { createLogger } from '@/lib/logs/console/logger'
|
||||
import { BaseCopilotTool } from '../base'
|
||||
|
||||
@@ -44,7 +45,7 @@ async function setEnvironmentVariables(
|
||||
})
|
||||
|
||||
// Forward the request to the existing environment variables endpoint
|
||||
const envUrl = `${process.env.NEXTAUTH_URL || 'http://localhost:3000'}/api/environment/variables`
|
||||
const envUrl = `${env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000'}/api/environment/variables`
|
||||
|
||||
const response = await fetch(envUrl, {
|
||||
method: 'PUT',
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { env } from '@/lib/env'
|
||||
import { createLogger } from '@/lib/logs/console/logger'
|
||||
import { getAllBlocks } from '@/blocks/registry'
|
||||
import type { BlockConfig } from '@/blocks/types'
|
||||
@@ -6,8 +7,8 @@ import { generateLoopBlocks, generateParallelBlocks } from '@/stores/workflows/w
|
||||
import { BaseCopilotTool } from '../base'
|
||||
|
||||
// Sim Agent API configuration
|
||||
const SIM_AGENT_API_URL = process.env.SIM_AGENT_API_URL || 'http://localhost:8000'
|
||||
const SIM_AGENT_API_KEY = process.env.SIM_AGENT_API_KEY
|
||||
const SIM_AGENT_API_URL = env.SIM_AGENT_API_URL || 'http://localhost:8000'
|
||||
const SIM_AGENT_API_KEY = env.SIM_AGENT_API_KEY
|
||||
|
||||
interface BuildWorkflowParams {
|
||||
yamlContent: string
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { env } from '@/lib/env'
|
||||
import { createLogger } from '@/lib/logs/console/logger'
|
||||
import { getAllBlocks } from '@/blocks/registry'
|
||||
import type { BlockConfig } from '@/blocks/types'
|
||||
@@ -7,8 +8,8 @@ import { generateLoopBlocks, generateParallelBlocks } from '@/stores/workflows/w
|
||||
const logger = createLogger('EditWorkflowAPI')
|
||||
|
||||
// Sim Agent API configuration
|
||||
const SIM_AGENT_API_URL = process.env.SIM_AGENT_API_URL || 'http://localhost:8000'
|
||||
const SIM_AGENT_API_KEY = process.env.SIM_AGENT_API_KEY
|
||||
const SIM_AGENT_API_URL = env.SIM_AGENT_API_URL || 'http://localhost:8000'
|
||||
const SIM_AGENT_API_KEY = env.SIM_AGENT_API_KEY
|
||||
|
||||
// Types for operations
|
||||
interface EditWorkflowOperation {
|
||||
|
||||
@@ -5,10 +5,6 @@ import { db } from '@/db'
|
||||
import { workflow as workflowTable } from '@/db/schema'
|
||||
import { BaseCopilotTool } from '../base'
|
||||
|
||||
// Sim Agent API configuration
|
||||
const SIM_AGENT_API_URL = process.env.SIM_AGENT_API_URL || 'http://localhost:8000'
|
||||
const SIM_AGENT_API_KEY = process.env.SIM_AGENT_API_KEY
|
||||
|
||||
interface GetUserWorkflowParams {
|
||||
workflowId: string
|
||||
includeMetadata?: boolean
|
||||
|
||||
@@ -58,6 +58,7 @@ export const env = createEnv({
|
||||
FREESTYLE_API_KEY: z.string().min(1).optional(), // Freestyle AI API key
|
||||
OLLAMA_URL: z.string().url().optional(), // Ollama local LLM server URL
|
||||
ELEVENLABS_API_KEY: z.string().min(1).optional(), // ElevenLabs API key for text-to-speech in deployed chat
|
||||
SERPER_API_KEY: z.string().min(1).optional(), // Serper API key for online search
|
||||
|
||||
// Azure OpenAI Configuration
|
||||
AZURE_OPENAI_ENDPOINT: z.string().url().optional(), // Azure OpenAI service endpoint
|
||||
|
||||
Reference in New Issue
Block a user