mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-28 03:00:29 -04:00
fix(file-upload): re-enabled file upload for mistral & url for file upload (#408)
* re-enabled file upload for mistral & url for file upload * consolidated env checks
This commit is contained in:
@@ -1,27 +1,23 @@
|
||||
import { existsSync } from 'fs'
|
||||
import { mkdir } from 'fs/promises'
|
||||
import path, { join } from 'path'
|
||||
import { isProd } from '@/lib/environment'
|
||||
import { createLogger } from '@/lib/logs/console-logger'
|
||||
import { env } from '../env'
|
||||
|
||||
const logger = createLogger('UploadsSetup')
|
||||
|
||||
// Define project root - this works regardless of how the app is started
|
||||
const PROJECT_ROOT = path.resolve(process.cwd())
|
||||
|
||||
// Define the upload directory path using project root
|
||||
export const UPLOAD_DIR = join(PROJECT_ROOT, 'uploads')
|
||||
|
||||
export const USE_S3_STORAGE = env.NODE_ENV === 'production' || env.USE_S3
|
||||
export const USE_S3_STORAGE = isProd
|
||||
|
||||
export const S3_CONFIG = {
|
||||
bucket: env.S3_BUCKET_NAME || '',
|
||||
region: env.AWS_REGION || '',
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that the uploads directory exists (for local storage)
|
||||
*/
|
||||
export async function ensureUploadsDirectory() {
|
||||
if (USE_S3_STORAGE) {
|
||||
logger.info('Using S3 storage, skipping local uploads directory creation')
|
||||
|
||||
Reference in New Issue
Block a user