pmng/src/pmng/app_settings.cr

29 lines
595 B
Crystal
Raw Normal View History

2022-08-04 00:10:56 +03:00
def password_file
2022-08-07 21:29:12 +03:00
# Return password file path
2022-08-04 00:10:56 +03:00
begin
file_path = "#{ENV["PMNG_PWD_FILE"]}"
file_path.to_s
rescue KeyError
file_path = "#{ENV["HOME"]}/.pwd.yml"
file_path.to_s
end
end
2022-08-07 21:23:59 +03:00
def input_timeout
2022-08-07 21:29:12 +03:00
# Return user input timeout
2022-08-07 21:23:59 +03:00
user_input_timeout = 60
begin
user_input_timeout = "#{ENV["PMNG_TIMEOUT"]}"
user_input_timeout.to_i
rescue KeyError
2022-08-07 21:29:12 +03:00
user_input_timeout.to_i # return default 60s
2022-08-07 21:23:59 +03:00
end
end
2022-07-31 01:40:30 +03:00
VERSION = {{ `shards version "#{__DIR__}"`.chomp.stringify }}
2022-08-04 00:10:56 +03:00
PASSWORD_FILE_PATH = password_file()
2022-08-07 21:23:59 +03:00
USER_INPUT_TIMEOUT = input_timeout()