fix: remove clg
This commit is contained in:
13
package-lock.json
generated
13
package-lock.json
generated
@@ -11,6 +11,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@infisical/sdk": "^4.0.6",
|
"@infisical/sdk": "^4.0.6",
|
||||||
"@types/express": "^5.0.3",
|
"@types/express": "^5.0.3",
|
||||||
|
"dotenv": "^17.2.3",
|
||||||
"effect": "^3.18.4",
|
"effect": "^3.18.4",
|
||||||
"express": "^5.1.0"
|
"express": "^5.1.0"
|
||||||
},
|
},
|
||||||
@@ -2998,6 +2999,18 @@
|
|||||||
"node": ">=6.0.0"
|
"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": {
|
"node_modules/dunder-proto": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@infisical/sdk": "^4.0.6",
|
"@infisical/sdk": "^4.0.6",
|
||||||
"@types/express": "^5.0.3",
|
"@types/express": "^5.0.3",
|
||||||
|
"dotenv": "^17.2.3",
|
||||||
"effect": "^3.18.4",
|
"effect": "^3.18.4",
|
||||||
"express": "^5.1.0"
|
"express": "^5.1.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Effect } from "effect";
|
import { Effect } from "effect";
|
||||||
import { InfisicalSDK } from '@infisical/sdk'
|
import { InfisicalSDK } from '@infisical/sdk'
|
||||||
|
import dotenv from 'dotenv';
|
||||||
/**
|
/**
|
||||||
* Abstract base class for API clients that provides secure credential management through Infisical.
|
* 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
|
* - `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 {
|
abstract class Client {
|
||||||
|
|
||||||
|
// log env variables to verify they are loaded
|
||||||
|
|
||||||
private infisicalClient: InfisicalSDK;
|
private infisicalClient: InfisicalSDK;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.infisicalClient = new InfisicalSDK({
|
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> {
|
init(): Effect.Effect<void, Error, never> {
|
||||||
console.log(INFISICAL_URL)
|
|
||||||
console.log(INFISICAL_CLIENT_ID)
|
|
||||||
console.log(INFISICAL_CLIENT_SECRET)
|
|
||||||
return Effect.tryPromise({
|
return Effect.tryPromise({
|
||||||
try: () => this.infisicalClient.auth().universalAuth.login({
|
try: () => this.infisicalClient.auth().universalAuth.login({
|
||||||
clientId: INFISICAL_CLIENT_ID,
|
clientId: process.env.INFISICAL_CLIENT_ID!,
|
||||||
clientSecret: INFISICAL_CLIENT_SECRET,
|
clientSecret: process.env.INFISICAL_CLIENT_SECRET!,
|
||||||
}),
|
}),
|
||||||
catch: (error) => new Error(`Failed to login to Infisical: ${error}`),
|
catch: (error) => new Error(`Failed to login to Infisical: ${error}`),
|
||||||
})
|
})
|
||||||
@@ -49,7 +49,7 @@ abstract class Client {
|
|||||||
const secret = yield* Effect.tryPromise({
|
const secret = yield* Effect.tryPromise({
|
||||||
try: () => self.infisicalClient.secrets().getSecret({
|
try: () => self.infisicalClient.secrets().getSecret({
|
||||||
environment: "dev",
|
environment: "dev",
|
||||||
projectId: INFISICAL_PROJECT_ID!,
|
projectId: process.env.INFISICAL_PROJECT_ID!,
|
||||||
secretName: key,
|
secretName: key,
|
||||||
}),
|
}),
|
||||||
catch: (error) => new Error(`Failed to get secret ${key} from Infisical: ${error}`),
|
catch: (error) => new Error(`Failed to get secret ${key} from Infisical: ${error}`),
|
||||||
|
|||||||
Reference in New Issue
Block a user