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.
Store the content of the file as a secret
In your CI, have a script section that outputs the stored secret into a file in the root of your codebase, e.g
ONBOARDBASE_TOKEN="xxxxxxxxxx" ONBOARDBASE_PROJECT="project_name" ONBOARDBASE_ENVIRONMENT="environment_name" onboardbase run "echo $SSH_KEY > ssh_key.private"
- 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.
Updated about 1 year ago