Russell
Russell2mo ago

Calling for secret key from JS

Hello I am having issues utilizing my secret key on buildship when creating a node juse from code. The code works when I put the API in directly but I dont know now to call for the secret key that is stored out side of the file so that I dont have to include the API in the script
2 Replies
AI Support
AI Support2mo ago
AI Support Bot Information
<@270677592783323136> you can react on the relevant answer (message) with a ✅ in this thread when you think it has been solved, by the bot or by a human! Anyone can react on this message with a ❌ if the GPT bot is unhelpful or hallucinating answers. Please note: Team members will review and answer the questions on best efforts basis.
AI Support
AI Support2mo ago
AI Response
To securely use your secret key without directly embedding it in your script, you can utilize the built-in secret management features in BuildShip. Here are the steps you can follow: 1. Storing Secrets: - BuildShip provides a method to securely store and manage your API keys and other sensitive information through its Secret Manager. You can store your API keys in the Secret Manager instead of hardcoding them in your script . 2. Accessing Secrets: - You can then access these secrets in your node's code without exposing them directly. Here’s an example of how you might access a secret in your code:
const apiKey = process.env.MY_SECRET_API_KEY;

const apiKey = process.env.MY_SECRET_API_KEY;

- Ensure that you configure your environment variable (MY_SECRET_API_KEY in this case) through the BuildShip's environment variable configuration . 3. Node Configuration: When configuring your nodes, use the value expression editor to leverage variables and safeguard sensitive information using secret keys. By following these steps and utilizing BuildShip's environment variables and secret management systems, you can keep your API keys secure and prevent them from being exposed in your script. For more detailed information, you can refer to the BuildShip documentation on secrets and environment variables .
BuildShip AI Support