diff --git a/doc/use/conf_env_var.md b/doc/use/conf_env_var.md index 8cfe5f1ec21b8cf7bbc91f3f7cf715cee141f076..60c556b9e940bedc417af37e13f075fc9caf83e7 100644 --- a/doc/use/conf_env_var.md +++ b/doc/use/conf_env_var.md @@ -22,6 +22,14 @@ By default this keypair is random, so the duniter node is a mirror node. To modify the keypair of the node, you must create a keypair in a file and indicate the path to this file with the environment variable `DUNITER_KEYFILE`. +## Configuring the proof of work parameters + +The PoW prefix, cpu usage, and number of workers can be configured with these environment variables: + +* `DUNITER_POW_PREFIX` (integer) +* `DUNITER_POW_CPU` (decimal number between 0 and 1) +* `DUNITER_POW_NBCORES` (integer) + ## Configuring the network ### The APIs diff --git a/index.ts b/index.ts index f7dd1363ab6c0235c833230f192bdde6971a087c..42afaec11f2408a08f6689b7e8a9e00a56ec5c7d 100644 --- a/index.ts +++ b/index.ts @@ -485,8 +485,8 @@ function commandLineConf(program:any, conf:any = {}) { conf = conf || {}; const cli = { currency: program.currency, - cpu: program.cpu, - nbCores: program.nbCores, + cpu: process.env.DUNITER_POW_CPU ? parseFloat(process.env.DUNITER_POW_CPU) : program.cpu, + nbCores: process.env.DUNITER_POW_NBCORES ? parseInt(process.env.DUNITER_POW_NBCORES) : program.nbCores, prefix: program.prefix, server: { port: program.port,