Skip to content

Commit

Permalink
build: add AUTH_PUBLIC_KEY vars to gen-env.sh script
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Jul 1, 2024
1 parent 3493c27 commit 47759ee
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions scripts/gen-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,28 @@ check_change_port() {
fi
}

generate_auth_keys() {
pretty_echo "Generating Auth Keys"

if ! AUTH_PRIVATE_KEY=$(openssl genrsa 4096 2>/dev/null); then
echo "Error generating private key. Aborting."
return 1
fi

if ! AUTH_PUBLIC_KEY=$(echo "$AUTH_PRIVATE_KEY" | openssl rsa -pubout 2>/dev/null); then
echo "Error generating public key. Aborting."
return 1
fi

# Quotes are required around key variables, else dotenv does not load
export AUTH_PRIVATE_KEY="\"$AUTH_PRIVATE_KEY\""
export AUTH_PUBLIC_KEY="\"$AUTH_PUBLIC_KEY\""

echo
echo "Auth keys generated."
echo
}

generate_dotenv() {
pretty_echo "Generating Dotenv File"

Expand Down Expand Up @@ -390,6 +412,7 @@ prompt_user_gen_dotenv() {
fi

set_osm_credentials
generate_auth_keys
generate_dotenv

pretty_echo "Completed dotenv file generation"
Expand Down

0 comments on commit 47759ee

Please sign in to comment.