Some small refactoring

This commit is contained in:
Gregory Schier
2024-07-21 22:18:45 -07:00
parent 3cd7c1ef2e
commit 19280c3bbc
4 changed files with 16 additions and 16 deletions

View File

@@ -76,12 +76,12 @@ async function* errorHandlingMiddleware<Request, Response>(
server = server.use(errorHandlingMiddleware);
server.add(PluginRuntimeDefinition, new PluginRuntimeService());
// Start on random port if GRPC_PORT_FILE_PATH is set, or :4000
const addr = process.env.GRPC_PORT_FILE_PATH ? 'localhost:0' : 'localhost:4000';
// Start on random port if YAAK_GRPC_PORT_FILE_PATH is set, or :4000
const addr = process.env.YAAK_GRPC_PORT_FILE_PATH ? 'localhost:0' : 'localhost:4000';
server.listen(addr).then((port) => {
console.log('gRPC server listening on', `http://localhost:${port}`);
if (process.env.GRPC_PORT_FILE_PATH) {
console.log('Wrote port file to', process.env.GRPC_PORT_FILE_PATH);
fs.writeFileSync(process.env.GRPC_PORT_FILE_PATH, JSON.stringify({ port }, null, 2));
if (process.env.YAAK_GRPC_PORT_FILE_PATH) {
console.log('Wrote port file to', process.env.YAAK_GRPC_PORT_FILE_PATH);
fs.writeFileSync(process.env.YAAK_GRPC_PORT_FILE_PATH, JSON.stringify({ port }, null, 2));
}
});

View File

@@ -9,7 +9,7 @@ export interface PluginInfo {
}
export function loadPlugins(): PluginHandle[] {
const pluginsDir = process.env.PLUGINS_DIR;
const pluginsDir = process.env.YAAK_PLUGINS_DIR;
if (!pluginsDir) throw new Error('PLUGINS_DIR is not set');
console.log('Loading plugins from', pluginsDir);