Skip to content

Commit

Permalink
Can now assign a custom process title. Fixes lwsjs/local-web-server#186.
Browse files Browse the repository at this point in the history
  • Loading branch information
75lb committed Aug 29, 2024
1 parent 3557eb2 commit d586d5d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The lws configuration options.
* [.stack](#module_lws-config--LwsConfig+stack) : <code>Array.&lt;string&gt;</code> \| [<code>Array.&lt;MiddlewarePlugin&gt;</code>](https://github.com/lwsjs/lws/blob/master/doc/middleware-plugin.md)
* [.moduleDir](#module_lws-config--LwsConfig+moduleDir) : <code>string</code> \| <code>Array.&lt;string&gt;</code>
* [.view](#module_lws-config--LwsConfig+view) : <code>string</code>
* [.title](#module_lws-config--LwsConfig+title) : <code>string</code>

<a name="exp_module_lws-config--LwsConfig"></a>

Expand Down Expand Up @@ -120,3 +121,10 @@ Custom view instance.

**Kind**: instance property of [<code>LwsConfig</code>](#exp_module_lws-config--LwsConfig)
**Default**: <code>null</code>
<a name="module_lws-config--LwsConfig+title"></a>

#### lwsConfig.title : <code>string</code>
Give the process a more useful title than the default `node`. This helps to find your server in utilities like `ps`, Task Manager, Activity Monitor etc.

**Kind**: instance property of [<code>LwsConfig</code>](#exp_module_lws-config--LwsConfig)
**Default**: <code>null</code>
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ class Lws extends EventEmitter {
await lws.loadStoredConfig()
}

/* Assign the process title */
if (config.title) process.title = config.title

/* attach the view */
lws.useView()

Expand Down
6 changes: 6 additions & 0 deletions lib/cli-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,11 @@ export default [
type: Boolean,
description: 'Print a list of available network interfaces. Used in conjunction with `--qr`.',
section: 'core'
},
{
name: 'title',
type: String,
description: 'Give the process a more useful title than the default `node`. This helps to find your server in utilities like `ps`, Task Manager, Activity Monitor etc.',
section: 'core'
}
]
7 changes: 7 additions & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ class LwsConfig {
* @default
*/
this.view = null

/**
* Give the process a more useful title than the default `node`. This helps to find your server in utilities like `ps`, Task Manager, Activity Monitor etc.
* @type {string}
* @default
*/
this.title = null
}
}

Expand Down

0 comments on commit d586d5d

Please sign in to comment.