Skip to content

Commit

Permalink
feat: add env to skip uploading to akord
Browse files Browse the repository at this point in the history
  • Loading branch information
thejustinwalsh committed Sep 11, 2024
1 parent a3726ad commit 1bba833
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ target
node_modules
test-ledger
.yarn
.vscode/
.vscode/
.env
11 changes: 10 additions & 1 deletion app/.env.template
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
NEXT_PUBLIC_WALLET_NETWORK=devnet
# This file is a template for the .env file that should be created in the root of the project
# The .env file should be created by copying this file and filling in the values
# The .env file should not be committed to the repository

# Default network to use for the web3 connection
NEXT_PUBLIC_WALLET_NETWORK=devnet

# Set to true to skip uploading files to Arweave
FAKE_UPLOADS=false

9 changes: 9 additions & 0 deletions app/app/api/upload/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ export async function POST(request: NextRequest) {
file
);

if (process.env.FAKE_UPLOADS) {
console.warn("Skipping upload to Akord, simulating upload...");
await new Promise((resolve) => setTimeout(resolve, 1000));
return NextResponse.json({
metadataUrl: `https://fake.uploads/${metadataFileName}`,
imageUrl: `https://fake.uploads/${imageFileName}`,
});
}

const arrayBuffer = await file.arrayBuffer();
const buffer = Buffer.from(arrayBuffer);

Expand Down

0 comments on commit 1bba833

Please sign in to comment.