Skip to content

Commit

Permalink
Remove problematic base64 characters from generated password
Browse files Browse the repository at this point in the history
Patch parts that did not apply automatically.
  • Loading branch information
simar0at committed Sep 9, 2024
1 parent e5225fa commit 6f356d4
Show file tree
Hide file tree
Showing 5 changed files with 981 additions and 934 deletions.
7 changes: 4 additions & 3 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ source "$BP_DIR/lib/yarn-2.sh"
export PATH="$BUILD_DIR/.heroku/node/bin:$BUILD_DIR/.heroku/yarn/bin":$PATH

export COREPACK_HOME="$BUILD_DIR/.heroku/corepack"
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0

LOG_FILE=$(mktemp -t node-build-log.XXXXX)
echo "" > "$LOG_FILE"
Expand Down Expand Up @@ -130,10 +131,10 @@ log_project_info "$BUILD_DIR"
### Compile

create_env() {
write_profile "$BP_DIR" "$BUILD_DIR"
write_export "$BP_DIR" "$BUILD_DIR"
export_env_dir "$ENV_DIR"
create_default_env "$YARN"
write_profile "$BP_DIR" "$BUILD_DIR"
write_export "$BP_DIR" "$BUILD_DIR"
}

header "Creating runtime environment" | output "$LOG_FILE"
Expand Down Expand Up @@ -354,7 +355,7 @@ install_bins() {
pushd "$BUILD_DIR/.heroku/basex/bin" >/dev/null
mv "$BUILD_DIR/.heroku/basex/data" "$BUILD_DIR/.heroku/basex/data.image"
ln -s data.image "$BUILD_DIR/.heroku/basex/data"
BASEX_admin_pw="${BASEX_admin_pw:-$(openssl rand -base64 12)}"
BASEX_admin_pw="${BASEX_admin_pw:-$(openssl rand -base64 12 | | tr -d '+/=')}"
echo "BASEX_admin_pw=\"$BASEX_admin_pw\"" > "$BUILD_DIR/.heroku/basex/data/credentials"
echo "CYPRESS_BASEX_admin_pw=\"$BASEX_admin_pw\"" >> "$BUILD_DIR/.heroku/basex/data/credentials"
echo "BaseX admin password is \"$BASEX_admin_pw\""
Expand Down
2 changes: 1 addition & 1 deletion bin/set-basex-admin-password
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

BUILD_DIR=${1:-}

new_admin_pw="${BASEX_admin_pw:-$(openssl rand -base64 12)}"
new_admin_pw="${BASEX_admin_pw:-$(openssl rand -base64 12 | | tr -d '+/=')}"
if [ -f $BUILD_DIR/.heroku/basex/data/credentials ]
then
source $BUILD_DIR/.heroku/basex/data/credentials
Expand Down
31 changes: 27 additions & 4 deletions bin/test
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,33 @@ set -o allexport
source "$BUILD_DIR/.heroku/basex/data/credentials"
set +o allexport

if yarn --version > /dev/null 2>&1; then
cd "$BUILD_DIR" && yarn test
else
cd "$BUILD_DIR" && npm test
read_package_json() {
local key="$1"
# shellcheck disable=SC2002
cat "$BUILD_DIR/package.json" | jq -c -M --raw-output "$key // \"\"" || return 1
}

which_tool() {
yarn_engine=$(read_package_json ".engines.yarn")
pnpm_engine=$(read_package_json ".engines.pnpm")
package_manager=$(read_package_json ".packageManager")
if [ -n "$pnpm_engine" ] || [[ "$package_manager" == pnpm* ]]; then
echo "pnpm"
elif [ -n "$yarn_engine" ] || [[ "$package_manager" == yarn* ]]; then
echo "yarn"
else
echo "npm"
fi
}

tool=$(which_tool)

if [[ "$tool" == "pnpm" ]]; then
cd "$BUILD_DIR" && pnpm test
elif [[ "$tool" == "yarn" ]]; then
cd "$BUILD_DIR" && yarn test
else
cd "$BUILD_DIR" && npm test
fi
testResult=$?

Expand Down
Loading

0 comments on commit 6f356d4

Please sign in to comment.