Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to inject secrets into node js project via sdk? #9

Closed
suryaadithya opened this issue Nov 29, 2024 · 1 comment
Closed

How to inject secrets into node js project via sdk? #9

suryaadithya opened this issue Nov 29, 2024 · 1 comment

Comments

@suryaadithya
Copy link

No description provided.

@DanielHougaard
Copy link
Collaborator

Hi @suryaadithya, it can be achieved by writing to the process.env, here's an example:

	const client = new InfisicalSDK({
		siteUrl: "https://app.infisical.com"
	});

	await client.auth().universalAuth.login({
		clientId: "<machine-identity-client-id>",
		clientSecret: "<machine-identity-client-secret>"
	});

	const { secrets } = await client.secrets().listSecrets({
		environment: "dev",
		projectId: "<project-id",
		expandSecretReferences: true
	});

	for (const secret of secrets) {
		process.env[secret.secretKey] = secret.secretValue; // <--- This!
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants