From abdb758aa2ed2665d49fd8ea6a5bca9558ff31b1 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Sun, 7 Aug 2022 21:23:59 +0300 Subject: [PATCH] user input timeout env variable --- HISTORY.md | 3 +++ shard.yml | 2 +- src/pmng/app_settings.cr | 13 ++++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 2c75b83..121a3f2 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -6,6 +6,9 @@ - ℹ️ - Information - ♻️ - Edited +## 0.2.7 - [00/08/2022] +- ➕ - Added environment variable for custom input timeout + ## 0.2.6 - [03/08/2022] - ➕ - Added environment variable for custom password file path - ➕ - Added version in to ASCII logo diff --git a/shard.yml b/shard.yml index 94085fb..02cf981 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: pmng -version: 0.2.6 +version: 0.2.7 authors: - Alexander Popov diff --git a/src/pmng/app_settings.cr b/src/pmng/app_settings.cr index 8af82b7..79aea3c 100644 --- a/src/pmng/app_settings.cr +++ b/src/pmng/app_settings.cr @@ -8,6 +8,17 @@ def password_file end end +def input_timeout + user_input_timeout = 60 + + begin + user_input_timeout = "#{ENV["PMNG_TIMEOUT"]}" + user_input_timeout.to_i + rescue KeyError + user_input_timeout.to_i + end +end + VERSION = {{ `shards version "#{__DIR__}"`.chomp.stringify }} PASSWORD_FILE_PATH = password_file() -USER_INPUT_TIMEOUT = 60 +USER_INPUT_TIMEOUT = input_timeout()