Skip to content

Commit 24f4199

Browse files
Merge pull request #25 from gitbito/release/1.3.2-new
Update bito-cra.sh
2 parents 9d5e47a + ef8ee16 commit 24f4199

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

cra-scripts/bito-cra.sh

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ optional_params_server=(
423423
"code_context"
424424
"nexus_url"
425425
"cr_event_type"
426-
"encryption_key"
427426
)
428427

429428
bee_params=(
@@ -576,8 +575,6 @@ for param in "${required_params[@]}" "${bee_params[@]}" "${optional_params[@]}";
576575
nexus_url=$(echo "${props[$param]}" | sed 's/^[ \t]*//;s/[ \t]*$//')
577576
elif [ "$param" == "cr_event_type" ]; then
578577
validate_cr_event_type "${props[$param]}"
579-
elif [ "$param" == "encryption_key" ]; then
580-
encryption_key_value=${props[$param]}
581578
else
582579
docker_cmd+=" --$param=${props[$param]}"
583580
fi
@@ -614,22 +611,15 @@ encrypt_git_secret() {
614611

615612
param_bito_access_key="bito_cli.bito.access_key"
616613
param_git_access_token="git.access_token"
617-
param_encryption_key="encryption_key"
614+
618615
docker_enc_params=
619616
if [ "$mode" == "server" ]; then
620617
if [ -n "${props[$param_bito_access_key]}" ] && [ -n "${props[$param_git_access_token]}" ]; then
621618
git_secret="${props[$param_bito_access_key]}@#~^${props[$param_git_access_token]}"
622-
623-
if [ -n "${props[$param_encryption_key]}" ]; then
624-
encryption_key="${props[$param_encryption_key]}"
625-
if [[ ${#encryption_key} -eq 44 ]] && [[ $encryption_key =~ ^[A-Za-z0-9+/]{43}=$ ]]; then
626-
git_secret=$(encrypt_git_secret "$encryption_key" "$git_secret")
627-
docker_enc_params=" --git.secret=$git_secret --encryption_key=$encryption_key"
628-
else
629-
echo "Error: Encryption key must be a 44-character base64 string generated by openssl rand -base64 32."
630-
exit 1
631-
fi
632-
fi
619+
encryption_key=$(openssl rand -base64 32)
620+
git_secret=$(encrypt_git_secret "$encryption_key" "$git_secret")
621+
docker_enc_params=" --git.secret=$git_secret --encryption_key=$encryption_key"
622+
633623

634624
echo "Use below as Gitlab and Github Webhook secret:"
635625
echo "$git_secret"

0 commit comments

Comments
 (0)