inital commit
This commit is contained in:
11
packages/utils/package.json
Normal file
11
packages/utils/package.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "utils",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"main": "./src/index.ts",
|
||||
"types": "./src/index.ts"
|
||||
}
|
15
packages/utils/src/envVariables.ts
Normal file
15
packages/utils/src/envVariables.ts
Normal file
@ -0,0 +1,15 @@
|
||||
/**
|
||||
* Checks if all environment variables are set
|
||||
*
|
||||
* @param variables the environment variables to check
|
||||
* @returns true if all variables are set, false otherwise
|
||||
*/
|
||||
export function checkEnvironmentVariables(...variables: string[]): boolean {
|
||||
let allVariablesSet = true;
|
||||
variables.forEach((variable) => {
|
||||
if (!process.env[variable]) {
|
||||
throw new Error(`${variable} not set in environment variables`);
|
||||
}
|
||||
});
|
||||
return allVariablesSet;
|
||||
}
|
2
packages/utils/src/index.ts
Normal file
2
packages/utils/src/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
export * from "./envVariables";
|
||||
export * from "./secrets";
|
16
packages/utils/src/secrets.ts
Normal file
16
packages/utils/src/secrets.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import InfisicalClient from "infisical-node";
|
||||
|
||||
/**
|
||||
* Create an infisical client
|
||||
*
|
||||
* @param token the infisical token
|
||||
* @returns the infisical client
|
||||
*/
|
||||
function createInfisicalClient(token: string) {
|
||||
return new InfisicalClient({
|
||||
token,
|
||||
siteURL: "https://secrets.fascinated.cc",
|
||||
});
|
||||
}
|
||||
|
||||
export { createInfisicalClient };
|
7
packages/utils/tsconfig.json
Normal file
7
packages/utils/tsconfig.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "tsconfig/server.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"rootDir": "src"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user