Skip to main content
Cluster.setupPrimary - node__cluster.d.ts - Node documentation
method Cluster.setupPrimary

Usage in Deno

```typescript import { type Cluster } from "node:node__cluster.d.ts"; ```
Cluster.setupPrimary(settings?: ClusterSettings): void
`setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in `cluster.settings`. Any settings changes only affect future calls to [`.fork()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clusterforkenv) and have no effect on workers that are already running. The only attribute of a worker that cannot be set via `.setupPrimary()` is the `env` passed to [`.fork()`](https://nodejs.org/docs/latest-v22.x/api/cluster.html#clusterforkenv). The defaults above apply to the first call only; the defaults for later calls are the current values at the time of `cluster.setupPrimary()` is called. ```js import cluster from 'node:cluster'; cluster.setupPrimary({ exec: 'worker.js', args: ['--use', 'https'], silent: true, }); cluster.fork(); // https worker cluster.setupPrimary({ exec: 'worker.js', args: ['--use', 'http'], }); cluster.fork(); // http worker ``` This can only be called from the primary process.

Parameters

optional
settings: ClusterSettings

Return Type

void