Skip to content
This repository was archived by the owner on Mar 5, 2019. It is now read-only.

Commit 1a24be7

Browse files
datedfaustbrian
authored andcommitted
refactor: use select for log level configuration (#80)
* refactor: use select for log level * chore: add 'ascii' to configuration outputs * chore: add log level config to core_configure * refactor: add fallback log level
1 parent 788784f commit 1a24be7

File tree

5 files changed

+44
-2
lines changed

5 files changed

+44
-2
lines changed

actions/core/configure.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ core_configure ()
1818

1919
core_configure_database
2020

21+
core_configure_log_level
22+
2123
__core_configure_post
2224

2325
configured=true
@@ -31,6 +33,8 @@ core_configure ()
3133

3234
core_configure_database
3335

36+
core_configure_log_level
37+
3438
__core_configure_post
3539

3640
configured=true
@@ -63,6 +67,8 @@ __core_configure_post ()
6367

6468
__core_configure_network ()
6569
{
70+
ascii
71+
6672
info "Which network would you like to configure?"
6773

6874
validNetworks=("mainnet" "devnet" "testnet")

actions/core/configure/database.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
core_configure_database ()
44
{
5+
ascii
6+
57
local envFile="${CORE_DATA}/.env"
68

79
. "$envFile"

actions/core/configure/log-level.sh

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,43 @@
22

33
core_configure_log_level ()
44
{
5+
ascii
6+
57
local envFile="${CORE_DATA}/.env"
68

79
. "$envFile"
810

9-
read -p "Enter the log level (debug, info, warning, error), or press ENTER for the default [$ARK_LOG_LEVEL]: " inputLevel
11+
info "Which log level would you like to configure?"
12+
13+
local validLevels=("debug" "info" "warning" "error")
14+
15+
local inputLevel=$ARK_LOG_LEVEL
16+
17+
select opt in "${validLevels[@]}"; do
18+
case "$opt" in
19+
"debug")
20+
inputLevel=debug
21+
break
22+
;;
23+
"info")
24+
inputLevel=info
25+
break
26+
;;
27+
"warning")
28+
inputLevel=warning
29+
break
30+
;;
31+
"error")
32+
inputLevel=error
33+
break
34+
;;
35+
*)
36+
echo "Invalid option $REPLY"
37+
;;
38+
esac
39+
done
1040

11-
if [[ ! -z "$inputLevel" ]]; then
41+
if [[ "$ARK_LOG_LEVEL" != "$inputLevel" ]]; then
1242
sed -i -e "s/ARK_LOG_LEVEL=$ARK_LOG_LEVEL/ARK_LOG_LEVEL=$inputLevel/g" "$envFile"
1343
fi
1444

actions/core/install.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ core_install ()
2424

2525
core_configure
2626

27+
ascii
28+
2729
success "Installed Ark Core!"
2830
fi
2931
}

modules/database.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ database_destroy ()
2020

2121
database_create ()
2222
{
23+
ascii
24+
2325
heading "Creating Database..."
2426

2527
wait_to_continue

0 commit comments

Comments
 (0)