Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bz1464020 fix memory definition #20

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openshift-auth-proxy",
"version": "0.1.0",
"version": "0.1.1",
"description": "Reverse proxy to authorize requests against OpenShift 3",
"main": "openshift-auth-proxy.js",
"bin": "./openshift-auth-proxy.js",
Expand Down
5 changes: 1 addition & 4 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ BYTES_PER_GIG="$((1024 * BYTES_PER_MEG))"

DEFAULT_MIN="$((64 * BYTES_PER_MEG))" #This is a guess

export NODE_OPTIONS=""

if echo "${OCP_AUTH_PROXY_MEMORY_LIMIT:-}" | grep -qE "^([[:digit:]]+)([GgMm])?i?$"; then
num="$(echo "${OCP_AUTH_PROXY_MEMORY_LIMIT}" | grep -oE "^[[:digit:]]+")"
unit="$(echo "${OCP_AUTH_PROXY_MEMORY_LIMIT}" | grep -oE "[GgMm]" || echo "")"
Expand All @@ -30,8 +28,7 @@ if echo "${OCP_AUTH_PROXY_MEMORY_LIMIT:-}" | grep -qE "^([[:digit:]]+)([GgMm])?i
num="${DEFAULT_MIN}"
fi

NODE_OPTIONS="--max-old-space-size=$((num / BYTES_PER_MEG))"
export NODE_OPTIONS
export NODE_OPTIONS="${NODE_OPTIONS:---max_old_space_size=$((num / BYTES_PER_MEG))}"
else
echo "Unable to process the OCP_AUTH_PROXY_MEMORY_LIMIT: '${OCP_AUTH_PROXY_MEMORY_LIMIT}'."
echo "It must be a number, optionally followed by 'G'(Gigabytes) or 'M' (Megabytes), e.g. 64M"
Expand Down