Skip to content

Commit

Permalink
do not import gcp-metadata rabbithole, if not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
jeldeklint committed Dec 3, 2024
1 parent d532231 commit ff29256
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/gcp.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import gcpMetaData from "gcp-metadata";

/**
* Fetches the Google Cloud Platform (GCP) project ID from the GCP metadata server.
*
Expand All @@ -9,7 +7,7 @@ export async function getGcpProjectId(): Promise<string | undefined> {
if (process.env.GCP_PROJECT) {
return process.env.GCP_PROJECT;
}

const gcpMetaData = await import("gcp-metadata");
const isAvailable = await gcpMetaData.isAvailable();
if (!isAvailable) return;

Expand Down

0 comments on commit ff29256

Please sign in to comment.