onboard_secrets

Onboard Secrets

Usage no npm install needed!

<script type="module">
  import onboardSecrets from 'https://cdn.skypack.dev/onboard_secrets';
</script>

README

Onboardbase Secrets Lib

How to use

import { SecretManager, secrets } from "@onboardbase/secrets";
const secretAccessKey = "Your secret access key on onboardbase";
const accessKeyId = "Your onboardbase access key"(async () => {

const options = {
    // Pass this option if you want the secretManager to auto-create a .env file for you in your specified path
    env: {
      filePath: "./.env",
      // This should be true if you want to over-write your existing .env file
      // it should be false if you just want to append the secrets from onboardbase to the .env file.
      overWriteExistingValues: false,
    },
}

  // Initialize the secret manager
  await new SecretManager().init({
    accessKeyId,
    secretAccessKey,
    ...options
  });

  /

  // You can load all secrets using secrets.load
  const allSecrets = secrets.load();
  console.log(allSecrets);

  // You can as well load a single secret by passing an argument to the secret.load function
  const dbUri = secrets.load("DATABASE_URI");
  console.log(dbUri);
})();