Skip to content

Commit f6ca50d

Browse files
Optional Workers: (getcord#24)
- Make Admin and Console workers optional via env variable
1 parent f40c5d3 commit f6ca50d

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

scripts/generate-dotenv.cjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ function buildProdEnv(commitHash) {
206206
DEMO_APPS_SHARED_SECRET: secrets.DEMO_APPS_SHARED_SECRET.key,
207207
LOOPS_SO_API_KEY: secrets.LOOPS_SO_API_KEY.api_key,
208208
PYROSCOPE_ENDPOINT: 'http://monitoring.int.cord.com:4040',
209+
IGNORE_ADMIN_SERVER_WORKER: false,
210+
IGNORE_CONSOLE_SERVER_WORKER: false,
209211
};
210212
}
211213

server/src/config/Env.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,4 +233,10 @@ export default magicEnv(process.env, {
233233

234234
// loops.so for sending newletters
235235
LOOPS_SO_API_KEY: required,
236+
237+
// Make Admin Server Optional
238+
IGNORE_ADMIN_SERVER_WORKER: optional,
239+
240+
// Make Admin Server Optional
241+
IGNORE_CONSOLE_SERVER_WORKER: optional,
236242
});

server/src/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ async function main() {
180180
// -------------------------------------------------------------------------
181181
// ADMIN
182182

183-
if (isSingleProcessOrMaster || workerType === 'admin') {
183+
if (!env.IGNORE_ADMIN_SERVER_WORKER && (isSingleProcessOrMaster || workerType === 'admin')) {
184184
// Either we are not in cluster mode, or this process is the master or an
185185
// 'admin' worker. (If this is a worker process of a different type, we skip
186186
// this section.)
@@ -210,7 +210,7 @@ async function main() {
210210
// -------------------------------------------------------------------------
211211
// CONSOLE
212212

213-
if (isSingleProcessOrMaster || workerType === 'console') {
213+
if (!env.IGNORE_CONSOLE_SERVER_WORKER && (isSingleProcessOrMaster || workerType === 'console')) {
214214
// Either we are not in cluster mode, or this process is the master or an
215215
// 'console' worker. (If this is a worker process of a different type, we skip
216216
// this section.)

0 commit comments

Comments
 (0)