Skip to content

Commit

Permalink
Passthrough env to runner in development mode
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalCz committed Mar 20, 2024
1 parent d395bff commit b3fdf69
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/adapters/src/process-instance-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { constants } from "fs";
import { access, readFile, rm } from "fs/promises";
import path from "path";
import { getRunnerEnvVariables } from "./get-runner-env";
import { development } from "@scramjet/sth-config";

const isTSNode = !!(process as any)[Symbol.for("ts-node.register.instance")];
const gotPython = "\n _ \n __ _____ _ __ ___ ___| |\n \\ \\ /\\ / / _ \\| '_ \\/ __|_ / |\n \\ V V / (_) | | | \\__ \\/ /|_|\n \\_/\\_/ \\___/|_| |_|___/___(_) 🐍\n";
Expand Down Expand Up @@ -152,6 +153,9 @@ class ProcessInstanceAdapter implements
config.sequenceDir,
config.entrypointPath
);

const extraEnvs = development() ? process.env : {};

const env = getRunnerEnvVariables({
sequencePath,
instancesServerHost: "127.0.0.1",
Expand All @@ -162,7 +166,8 @@ class ProcessInstanceAdapter implements
payload
}, {
PYTHONPATH: this.getPythonpath(config.sequenceDir),
...this.sthConfig.runnerEnvs
...this.sthConfig.runnerEnvs,
...extraEnvs
});

this.logger.debug("Spawning Runner process with command", runnerCommand);
Expand Down
2 changes: 1 addition & 1 deletion packages/host/src/lib/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export class Host implements IComponent {
this.logger = new ObjLogger(
this,
{},
ObjLogger.levels.find((l: LogLevel) => l.toLowerCase() === sthConfig.logLevel) ||
ObjLogger.levels.find((l: LogLevel) => l.toLowerCase() === sthConfig.logLevel.toLowerCase()) ||
ObjLogger.levels[ObjLogger.levels.length - 1]
);

Expand Down

0 comments on commit b3fdf69

Please sign in to comment.