Skip to content

Commit

Permalink
fix: sleep paraméter kezelés refaktorálva, doksi kiegészítve
Browse files Browse the repository at this point in the history
  • Loading branch information
juzraai committed Jan 7, 2024
1 parent fe0391e commit 39a326a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ OUTPUT_DIR=./szamlak


# Késleltetés a Díjnetnek küldött kérések előtt (másodpercben):
# Erre azért van szükség, hogy kevésbé terheljük a szervert. Javallott 3-5
# másodperces értéket beállítani.
# Erre azért van szükség, hogy kevésbé terheljük a szervert. A minimálisan
# megadható érték 3 másodperc.
SLEEP=3


Expand Down
4 changes: 2 additions & 2 deletions src/configurator.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function loadEnv(config) {
config.outputDir = process.env.OUTPUT_DIR || config.outputDir;
config.pass = process.env.DIJNET_PASS || config.pass;

config.sleep = Math.max(parseInt(process.env.SLEEP || 0, 10), config.sleep);
config.sleep = Math.max(parseInt(process.env.SLEEP, 10) || config.sleep, new Config().sleep);
config.tempDir = process.env.TEMP_DIR || config.tempDir;
config.user = process.env.DIJNET_USER || config.user;

Expand Down Expand Up @@ -72,7 +72,7 @@ function loadArgs(program, config) {

config.outputDir = program.outputDir || config.outputDir;
config.pass = program.pass || config.pass;
config.sleep = Math.max(parseInt(program.sleep || 0, 10), new Config().sleep); // env maybe modified, but CLI supposed to overwrite it, we have to maximize for default value
config.sleep = Math.max(parseInt(program.sleep, 10) || config.sleep, new Config().sleep);
config.tempDir = program.tempDir || config.tempDir;
config.user = program.user || config.user;

Expand Down

0 comments on commit 39a326a

Please sign in to comment.