diff --git a/src/secrets/secrets.ts b/src/secrets/secrets.ts index aa6a771..dec8b66 100644 --- a/src/secrets/secrets.ts +++ b/src/secrets/secrets.ts @@ -1,3 +1,4 @@ +import { GetOptions } from "infisical-node/src/types/InfisicalClient"; import { InfisicalClient } from ".."; let MONGO_URI: string; @@ -6,10 +7,18 @@ let MONGO_URI: string; * Initialize the secrets */ export async function initSecrets() { - const mongoUri = (await InfisicalClient.getSecret("MONGO_URI")).secretValue; + const options: GetOptions = { + environment: process.env.NODE_ENV === "production" ? "main" : "dev", + path: "/", + type: "shared", + }; + + const mongoUri = (await InfisicalClient.getSecret("MONGO_URI", options)) + .secretValue; if (!mongoUri) { - throw new Error("MONGO_URI not set in secrets"); + console.log("MONGO_URI not set in secrets"); + process.exit(1); } MONGO_URI = mongoUri;