fix: remove clg

This commit is contained in:
Louis
2025-10-26 16:28:57 +01:00
parent 63ba9a284d
commit 1490251a59
3 changed files with 25 additions and 11 deletions

13
package-lock.json generated
View File

@@ -11,6 +11,7 @@
"dependencies": {
"@infisical/sdk": "^4.0.6",
"@types/express": "^5.0.3",
"dotenv": "^17.2.3",
"effect": "^3.18.4",
"express": "^5.1.0"
},
@@ -2998,6 +2999,18 @@
"node": ">=6.0.0"
}
},
"node_modules/dotenv": {
"version": "17.2.3",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.3.tgz",
"integrity": "sha512-JVUnt+DUIzu87TABbhPmNfVdBDt18BLOWjMUFJMSi/Qqg7NTYtabbvSNJGOJ7afbRuv9D/lngizHtP7QyLQ+9w==",
"license": "BSD-2-Clause",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://dotenvx.com"
}
},
"node_modules/dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",

View File

@@ -21,6 +21,7 @@
"dependencies": {
"@infisical/sdk": "^4.0.6",
"@types/express": "^5.0.3",
"dotenv": "^17.2.3",
"effect": "^3.18.4",
"express": "^5.1.0"
},

View File

@@ -1,5 +1,6 @@
import { Effect } from "effect";
import { InfisicalSDK } from '@infisical/sdk'
import dotenv from 'dotenv';
/**
* Abstract base class for API clients that provides secure credential management through Infisical.
*
@@ -16,28 +17,27 @@ import { InfisicalSDK } from '@infisical/sdk'
* - `INFISICAL_PROJECT_ID`: The project ID in Infisical
*/
const INFISICAL_CLIENT_SECRET = "fe19b5e4463a1fbf54120eef9d4a54410b7729c0a874af76259c315d90b88eda"
const INFISICAL_CLIENT_ID = "5a4d5c85-c005-4a30-906c-517d9ccfe108"
const INFISICAL_URL = "https://vault.louisemard.dev"
const INFISICAL_PROJECT_ID = "e410a38e-f7a2-4b37-bfa2-7324c0bb38ab"
abstract class Client {
// log env variables to verify they are loaded
private infisicalClient: InfisicalSDK;
constructor() {
this.infisicalClient = new InfisicalSDK({
siteUrl: INFISICAL_URL,
siteUrl: process.env.INFISICAL_URL,
});
dotenv.config();
console.log("INFISICAL_URL:", process.env.INFISICAL_URL);
}
init(): Effect.Effect<void, Error, never> {
console.log(INFISICAL_URL)
console.log(INFISICAL_CLIENT_ID)
console.log(INFISICAL_CLIENT_SECRET)
return Effect.tryPromise({
try: () => this.infisicalClient.auth().universalAuth.login({
clientId: INFISICAL_CLIENT_ID,
clientSecret: INFISICAL_CLIENT_SECRET,
clientId: process.env.INFISICAL_CLIENT_ID!,
clientSecret: process.env.INFISICAL_CLIENT_SECRET!,
}),
catch: (error) => new Error(`Failed to login to Infisical: ${error}`),
})
@@ -49,7 +49,7 @@ abstract class Client {
const secret = yield* Effect.tryPromise({
try: () => self.infisicalClient.secrets().getSecret({
environment: "dev",
projectId: INFISICAL_PROJECT_ID!,
projectId: process.env.INFISICAL_PROJECT_ID!,
secretName: key,
}),
catch: (error) => new Error(`Failed to get secret ${key} from Infisical: ${error}`),