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

Allow config to be passed via env for testing #88

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

const semver = require('semver')
const flowForgeFileServer = require('./forge/fileServer')
const YAML = require('yaml')

const app = (async function () {
if (!semver.satisfies(process.version, '>=16.0.0')) {
Expand All @@ -11,7 +12,20 @@ const app = (async function () {
}

try {
const server = await flowForgeFileServer()
const options = {}
// The tests for `nr-persistent-context` run a local copy of the file-server
// and pass in the full config via this env var
if (process.env.FF_FS_TEST_CONFIG) {
try {
options.config = YAML.parse(process.env.FF_FS_TEST_CONFIG)
} catch (err) {
console.error('Failed to parse FF_FS_TEST_CONFIG:', err)
process.exitCode = 1
return
}
}

const server = await flowForgeFileServer(options)
let stopping = false
async function exitWhenStopped () {
if (!stopping) {
Expand Down