refactor: extract resourceBucket to process.env.SPACES_BUCKET
This commit is contained in:
parent
a0d78ae481
commit
5b4043c367
18
web/.env.example
Normal file
18
web/.env.example
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
POSTGRES_DATABASE="verceldb"
|
||||||
|
POSTGRES_HOST="localhost:5480"
|
||||||
|
POSTGRES_PASSWORD="postgres"
|
||||||
|
POSTGRES_PRISMA_URL="postgres://postgres:postgres@localhost:5480/verceldb?pgbouncer=true&connect_timeout=15"
|
||||||
|
POSTGRES_SSL="false"
|
||||||
|
POSTGRES_URL="postgres://postgres:postgres@localhost:5480/verceldb"
|
||||||
|
POSTGRES_URL_NON_POOLING="postgres://postgres:postgres@localhost:5480/verceldb"
|
||||||
|
POSTGRES_USER="postgres"
|
||||||
|
|
||||||
|
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
|
||||||
|
CLERK_SECRET_KEY=
|
||||||
|
|
||||||
|
SPACES_ENDPOINT="http://localhost:4566"
|
||||||
|
SPACES_ENDPOINT_CDN="http://localhost:4566"
|
||||||
|
SPACES_REGION="nyc3"
|
||||||
|
SPACES_BUCKET="comfyui-deploy"
|
||||||
|
SPACES_KEY="xyz"
|
||||||
|
SPACES_SECRET="aaa"
|
@ -19,7 +19,7 @@ export async function GET(request: Request) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const uploadUrl = await handleResourceUpload({
|
const uploadUrl = await handleResourceUpload({
|
||||||
resourceBucket: "comfyui-deploy",
|
resourceBucket: process.env.SPACES_BUCKET,
|
||||||
resourceId: `outputs/runs/${run_id}/${file_name}`,
|
resourceId: `outputs/runs/${run_id}/${file_name}`,
|
||||||
resourceType: type,
|
resourceType: type,
|
||||||
isPublic: true,
|
isPublic: true,
|
||||||
|
@ -32,7 +32,7 @@ export async function GET(request: Request) {
|
|||||||
for (let j = 0; j < output.data?.images.length; j++) {
|
for (let j = 0; j < output.data?.images.length; j++) {
|
||||||
const element = output.data?.images[j];
|
const element = output.data?.images[j];
|
||||||
element.url = replaceCDNUrl(
|
element.url = replaceCDNUrl(
|
||||||
`${process.env.SPACES_ENDPOINT}/comfyui-deploy/outputs/runs/${run.id}/${element.filename}`
|
`${process.env.SPACES_ENDPOINT}/${process.env.SPACES_BUCKET}/outputs/runs/${run.id}/${element.filename}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ export async function GET(request: NextRequest) {
|
|||||||
const file = new URL(request.url).searchParams.get("file");
|
const file = new URL(request.url).searchParams.get("file");
|
||||||
// console.log(`${process.env.SPACES_ENDPOINT}/comfyui-deploy/${file}`);
|
// console.log(`${process.env.SPACES_ENDPOINT}/comfyui-deploy/${file}`);
|
||||||
return NextResponse.redirect(
|
return NextResponse.redirect(
|
||||||
replaceCDNUrl(`${process.env.SPACES_ENDPOINT}/comfyui-deploy/${file}`)
|
replaceCDNUrl(
|
||||||
|
`${process.env.SPACES_ENDPOINT}/${process.env.SPACES_BUCKET}/${file}`
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user