Skip to content

Commit

Permalink
Merge pull request #88 from FlowFuse/allow-config-via-env
Browse files Browse the repository at this point in the history
Allow config to be passed via env for testing
  • Loading branch information
hardillb authored Oct 20, 2023
2 parents ffc5162 + 04b9c8f commit 41d1295
Showing 1 changed file with 15 additions and 1 deletion.
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

0 comments on commit 41d1295

Please sign in to comment.