Skip to content

Commit

Permalink
Use different blockfrost URL if NEXT_PUBLIC_BLOCKFROST_API_KEY not set
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mueller committed Jan 16, 2025
1 parent aaeb1a3 commit 4e722a5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 273 deletions.
272 changes: 4 additions & 268 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions frontend/src/app/utils/walletUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ export async function makeLucid() {
const API_KEY = process.env.NEXT_PUBLIC_BLOCKFROST_API_KEY;

if (!API_KEY) {
throw new Error(
"Missing required environment variables for Blockfrost context.",
);
console.warn("NEXT_PUBLIC_BLOCKFROST_API_KEY environment variable not found. Using blockfrost proxy.")
}

const blockfrostURL = "https://cardano-preview.blockfrost.io/api/v0";
const blockfrostURL =
API_KEY
? "https://cardano-preview.blockfrost.io/api/v0"
: "/blockfrost-proxy/api/v0";

const blockfrost = new Blockfrost(blockfrostURL, API_KEY);

const lucid = await Lucid(blockfrost, "Preview");
Expand Down
2 changes: 1 addition & 1 deletion nix/containers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
frontendNpm = pkgs.buildNpmPackage rec {
name = "frontend";
src = ../frontend;
npmDepsHash = "sha256-wtpNvgzcY0jpp5EgmWp4hXYfVs3xieq3Lb05tlhHlv4=";
npmDepsHash = "sha256-Bwa9mN/07zBXpZj9OoXY4YHluOyTLkvCd9RHuxw0XGo=";
npmPackFlags = [ "--ignore-scripts" ];
npmBuildScript = "export";
installPhase = ''
Expand Down

0 comments on commit 4e722a5

Please sign in to comment.