use environment when fetching infisical tokens
This commit is contained in:
parent
43bdcfe9e1
commit
35d78dc617
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user