##// END OF EJS Templates
feat(cli): made reading from .runtime.env file error prone...
super-admin -
Show More
@@ -1889,6 +1889,10 b' __dotenv_cmd=.env'
1889 REPLY=${BASH_REMATCH[4]%%$'\n'*} && REPLY=${REPLY%"${REPLY##*[![:space:]]}"}
1889 REPLY=${BASH_REMATCH[4]%%$'\n'*} && REPLY=${REPLY%"${REPLY##*[![:space:]]}"}
1890 }
1890 }
1891
1891
1892 .env.get_or_error() {
1893 .env.get "$@" || { echo "$(red ERROR required key $@ not set in $RUNTIME_ENV file)"; exit 1; }
1894 }
1895
1892 .env.parse() {
1896 .env.parse() {
1893 local line key
1897 local line key
1894 while IFS= read -r line; do
1898 while IFS= read -r line; do
@@ -1962,6 +1966,7 b' __dotenv_cmd=.env'
1962 printf %s "$__dotenv" >"$REPLY.bak" && mv "$REPLY.bak" "$REPLY"
1966 printf %s "$__dotenv" >"$REPLY.bak" && mv "$REPLY.bak" "$REPLY"
1963 esac
1967 esac
1964 }
1968 }
1969
1965 #
1970 #
1966 #__dotenv() {
1971 #__dotenv() {
1967 # set -eu
1972 # set -eu
@@ -2999,7 +3004,7 b' rcstack_self_update_command() {'
2999 mkdir -p $PWD/scripts/rcstack
3004 mkdir -p $PWD/scripts/rcstack
3000
3005
3001 .env --file $RUNTIME_ENV
3006 .env --file $RUNTIME_ENV
3002 .env get RC_VERSION
3007 .env get_or_error RC_VERSION
3003
3008
3004 ENV_VER=$REPLY
3009 ENV_VER=$REPLY
3005
3010
@@ -3278,19 +3283,19 b' rcstack_stack_status_command() {'
3278 VERBOSE=${args[-v]}
3283 VERBOSE=${args[-v]}
3279
3284
3280 .env --file $RUNTIME_ENV
3285 .env --file $RUNTIME_ENV
3281 .env get RC_APP_BASE_URL
3286 .env get_or_error RC_APP_BASE_URL
3282 RC_APP_BASE_URL=$REPLY
3287 RC_APP_BASE_URL=$REPLY
3283
3288
3284 .env get RC_VERSION
3289 .env get_or_error RC_VERSION
3285 RC_VERSION=$REPLY
3290 RC_VERSION=$REPLY
3286
3291
3287 .env get RC_SSH_PORT
3292 .env get_or_error RC_SSH_PORT
3288 RC_SSH_PORT=$REPLY
3293 RC_SSH_PORT=$REPLY
3289
3294
3290 .env get RC_EDITION
3295 .env get_or_error RC_EDITION
3291 RC_EDITION=$REPLY
3296 RC_EDITION=$REPLY
3292
3297
3293 .env get RC_LICENSE_TOKEN
3298 .env get_or_error RC_LICENSE_TOKEN
3294 RC_LICENSE_TOKEN=$REPLY
3299 RC_LICENSE_TOKEN=$REPLY
3295
3300
3296 if [[ $DEBUG ]]; then
3301 if [[ $DEBUG ]]; then
@@ -3411,10 +3416,10 b' rcstack_stack_upgrade_rhodecode_command() {'
3411 # search docker IDs for current service
3416 # search docker IDs for current service
3412 .env --file $RUNTIME_ENV
3417 .env --file $RUNTIME_ENV
3413
3418
3414 .env get RC_VERSION
3419 .env get_or_error RC_VERSION
3415 RC_VERSION=$REPLY
3420 RC_VERSION=$REPLY
3416
3421
3417 .env get RC_EDITION
3422 .env get_or_error RC_EDITION
3418 RC_EDITION=$REPLY
3423 RC_EDITION=$REPLY
3419
3424
3420 echo "Pulling new image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}"
3425 echo "Pulling new image: rhodecode/rhodecode-${RC_EDITION}:${RC_VERSION}"
@@ -3671,7 +3676,7 b' rcstack_cli_image_info_command() {'
3671 ver="unknown"
3676 ver="unknown"
3672 if [[ -f $RUNTIME_ENV ]]; then
3677 if [[ -f $RUNTIME_ENV ]]; then
3673 .env --file $RUNTIME_ENV
3678 .env --file $RUNTIME_ENV
3674 .env get RC_VERSION
3679 .env get_or_error RC_VERSION
3675 ver=$REPLY
3680 ver=$REPLY
3676 fi
3681 fi
3677
3682
@@ -3791,13 +3796,13 b' rcstack_cli_db_command() {'
3791
3796
3792 .env --file $RUNTIME_ENV
3797 .env --file $RUNTIME_ENV
3793
3798
3794 .env get DB_PASSWORD
3799 .env get_or_error DB_PASSWORD
3795 DB_PASSWORD=$REPLY
3800 DB_PASSWORD=$REPLY
3796
3801
3797 .env get DB_NAME
3802 .env get_or_error DB_NAME
3798 DB_NAME=$REPLY
3803 DB_NAME=$REPLY
3799
3804
3800 .env get DB_USER
3805 .env get_or_error DB_USER
3801 DB_USER=$REPLY
3806 DB_USER=$REPLY
3802
3807
3803 if [[ $DEBUG ]]; then
3808 if [[ $DEBUG ]]; then
@@ -4017,13 +4022,13 b' rcstack_backup_db_command() {'
4017
4022
4018 .env --file $RUNTIME_ENV
4023 .env --file $RUNTIME_ENV
4019
4024
4020 .env get DB_PASSWORD
4025 .env get_or_error DB_PASSWORD
4021 DB_PASSWORD=$REPLY
4026 DB_PASSWORD=$REPLY
4022
4027
4023 .env get DB_NAME
4028 .env get_or_error DB_NAME
4024 DB_NAME=$REPLY
4029 DB_NAME=$REPLY
4025
4030
4026 .env get DB_USER
4031 .env get_or_error DB_USER
4027 DB_USER=$REPLY
4032 DB_USER=$REPLY
4028
4033
4029 if [[ $DEBUG ]]; then
4034 if [[ $DEBUG ]]; then
General Comments 0
You need to be logged in to leave comments. Login now