Multi-line OpenSSL GPG Keys

Injecting Multi-line OpenSSL GPG Keys reading just the first line

Onboardbase has full support for multiline secrets like ssh keys. Some environments don't provide this support and tend to read just the first few lines of a secret. Luckily we have a solution for this :)

The idea is to read the secret as a file from the deployment environment while the content of the file is managed by Onboardbase.

  1. Store the content of the file as a secret

  2. In your CI, have a script section that outputs the stored secret into a file in the root of your codebase, e.g


onboardbase run "echo $SSH_KEY > ssh_key.private"
  1. Within your code, read a named file from the root of the project
var fs = require('fs'); 
const fsPromises = require('fs').promises;
const path = require("path")

const cwd = process.cwd();
const filePath = path.resolve(cwd, "ssh_key.private")
const sshKey = fsPromises.readFile(filePath);
// console.log(sshKey)

This would log the key that was stored locally via the onboardbase run command, making the file auto-generated in the server environment and the content managed by Onboardbase.