Skip to content
This repository was archived by the owner on Sep 10, 2019. It is now read-only.

Commit d6687eb

Browse files
committed
fix: use correct path and mode values for env vars
- if transpiled, use the transpiled data source dir instead of the original - pass the `--mock` setting to custom gateways through `GRAMPS_MODE` re #11, re #12
1 parent baed286 commit d6687eb

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

bin/dev.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,20 @@ export const handler = async ({
6262
}) => {
6363
warn('The GrAMPS CLI is intended for local development only.');
6464

65+
let dataSourcePaths = [];
6566
let loadedDataSources = [];
6667
if (dataSources.length) {
67-
loadedDataSources = await transpileDataSources(transpile, dataSources).then(
68-
loadDataSources,
69-
);
68+
// Get an array of paths to the local data sources.
69+
dataSourcePaths = await transpileDataSources(transpile, dataSources);
70+
loadedDataSources = loadDataSources(dataSourcePaths);
7071
}
7172

7273
// If a custom gateway was specified, set the env vars and start it.
7374
if (gateway) {
74-
// Define the `GRAMPS_DATA_SOURCES` env var.
75-
process.env.GRAMPS_DATA_SOURCES = dataSources.length
76-
? dataSources.join(',')
75+
// Define GrAMPS env vars.
76+
process.env.GRAMPS_MODE = mock ? 'mock' : 'live';
77+
process.env.GRAMPS_DATA_SOURCES = dataSourcePaths.length
78+
? dataSourcePaths.join(',')
7779
: '';
7880

7981
// Start the user-specified gateway.

0 commit comments

Comments
 (0)