Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions app/api/stores/template/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import { readFile, readdir } from 'fs/promises'
import { join } from 'path'
import outputs from '@/amplify_outputs.json'

// Forzar renderizado dinámico para acceder a variables de entorno en runtime
export const dynamic = 'force-dynamic'

interface TemplateRequest {
storeId: string
storeName: string
Expand All @@ -29,13 +26,6 @@ interface TemplateFile {

// Configuración de S3
const s3Client = new S3Client({
...(process.env.ACCESS_KEY_ID &&
process.env.SECRET_ACCESS_KEY && {
credentials: {
accessKeyId: process.env.ACCESS_KEY_ID,
secretAccessKey: process.env.SECRET_ACCESS_KEY,
},
}),
region: outputs.auth.aws_region,
})

Expand Down
9 changes: 1 addition & 8 deletions lib/store-renderer/services/template-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,13 @@ class TemplateLoader {
private readonly appEnv: string

private constructor() {
this.bucketName = outputs.storage.bucket_name || ''
this.bucketName = outputs.storage.bucket_name
this.cloudFrontDomain = process.env.CLOUDFRONT_DOMAIN_NAME || ''
this.appEnv = process.env.APP_ENV || 'development'

// Solo inicializar S3 si tenemos bucket configurado
if (this.bucketName) {
this.s3Client = new S3Client({
...(process.env.ACCESS_KEY_ID &&
process.env.SECRET_ACCESS_KEY && {
credentials: {
accessKeyId: process.env.ACCESS_KEY_ID,
secretAccessKey: process.env.SECRET_ACCESS_KEY,
},
}),
region: outputs.auth.aws_region,
})
}
Expand Down