From 9c8f704770c9148807e251ec92ef1445fcc177a1 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Fri, 28 Mar 2025 06:37:31 -0700 Subject: [PATCH] Switch default port to 5040 (product of 'xno' as digits). Improve formatting of environment variable section of documentation. --- README.md | 16 +++++++--------- docs/nano-pow.1 | 20 +++++++++++++------- src/bin/cli.ts | 2 +- src/bin/server.ts | 2 +- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 0c07fe5..f944899 100644 --- a/README.md +++ b/README.md @@ -136,18 +136,16 @@ official Nano node software. The installed command will launch the server in a detached process, and it can also be started manually to customize behavior by executing the server script directly. -`NANO_POW_PORT` can be passed as an environment variable and defaults to 3000 if -not specified. +#### Environment Variables +`NANO_POW_PORT`: override the default port 5040 -`NANO_POW_EFFORT` can also be passed as an environment variable to increase -or decrease the demand on the GPU. +`NANO_POW_EFFORT` increase or decrease demand on the GPU -`NANO_POW_DEBUG` can be set to enable additional logging saved to the HOME -directory. +`NANO_POW_DEBUG` enable additional logging saved to the HOME directory ```console $ # Launch the server and detach from the current session -$ PORT=8080 nano-pow --server +$ NANO_POW_PORT=8080 nano-pow --server $ # View process ID for "NanoPow Server" $ cat ~/.nano-pow/server.pid $ # Display list of server logs @@ -163,7 +161,7 @@ $ # Generate a work value $ curl -d '{ "action": "work_generate", "hash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" -}' localhost:3000 +}' localhost:5040 ``` ```console $ # Validate a work value @@ -171,7 +169,7 @@ $ curl -d '{ "action": "work_validate", "work": "e45835c3b291c3d1", "hash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" -}' localhost:3000 +}' localhost:5040 ``` ## Notes diff --git a/docs/nano-pow.1 b/docs/nano-pow.1 index ec4b586..a246a1d 100644 --- a/docs/nano-pow.1 +++ b/docs/nano-pow.1 @@ -50,12 +50,18 @@ It provides work generation and validation via HTTP requests in a similar, but n .PP More specifically, it does not support the \fIuse_peers\fR, \fImultiplier\fR, \fIaccount\fR, \fIversion\fR, \fIblock\fR, and \fIjson_block\fR options. .PP -By default, the server listens on port 3000. To use a different port, set the \fBPORT\fR environment variable before starting the server. +By default, the server listens on port 5040. -.PP -.EX -$ PORT=8080 nano-pow --server -.EE +.SS ENVIRONMENT VARIABLES +.TP +\fBNANO_POW_PORT\fR +Override the default port on which the NanoPow server listens for requests. +.TP +\fBNANO_POW_EFFORT\fR +Increase demand on GPU processing. Must be between 1 and 32 inclusive. +.TP +\fBNANO_POW_DEBUG\fR +Enable additional logging saved to the \fBHOME\fR directory. .PP The server process ID (PID) is saved to \fB~/.nano-pow/server.pid\fR. Log files are stored in \fB~/.nano-pow/logs/\fR. @@ -119,7 +125,7 @@ Generate a work value: $ curl -d '{ "action": "work_generate", "hash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" -}' localhost:3000 +}' localhost:5040 .EE .PP @@ -129,7 +135,7 @@ $ curl -d '{ "action": "work_validate", "work": "e45835c3b291c3d1", "hash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" -}' localhost:3000 +}' localhost:5040 .EE .SH AUTHOR diff --git a/src/bin/cli.ts b/src/bin/cli.ts index d1eb8e4..cb1136e 100755 --- a/src/bin/cli.ts +++ b/src/bin/cli.ts @@ -9,7 +9,7 @@ process.title = 'NanoPow CLI' process.env.NANO_POW_DEBUG = '' process.env.NANO_POW_EFFORT = '' -process.env.NANO_POW_PORT = '3000' +process.env.NANO_POW_PORT = '5040' function log (...args: any[]): void { if (process.env.NANO_POW_DEBUG) console.log(new Date(Date.now()).toLocaleString(), 'NanoPow', args) diff --git a/src/bin/server.ts b/src/bin/server.ts index 9bdaa72..9124d7d 100755 --- a/src/bin/server.ts +++ b/src/bin/server.ts @@ -17,7 +17,7 @@ const MAX_BODY_SIZE = 158 const DEBUG: boolean = !!(process.env.NANO_POW_DEBUG || false) const EFFORT: number = +(process.env.NANO_POW_EFFORT || 8) -const PORT: number = +(process.env.NANO_POW_PORT || 3000) +const PORT: number = +(process.env.NANO_POW_PORT || 5040) let browser: Browser let page: Page -- 2.34.1