Skip to content

Commit 3a0fdfd

Browse files
Check if the RUNTIME_CLASS is already set
1 parent 731428e commit 3a0fdfd

File tree

3 files changed

+54
-48
lines changed

3 files changed

+54
-48
lines changed

layers/console/bootstrap.sh

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,24 @@
33
# Fail on error
44
set -e
55

6-
export RUNTIME_CLASS="Bref\ConsoleRuntime\Main"
6+
# check if the RUNTIME_CLASS is already set
7+
if [ -z "${RUNTIME_CLASS}" ]; then
8+
export RUNTIME_CLASS="Bref\ConsoleRuntime\Main"
9+
fi
710

8-
while true
9-
do
10-
if [ -z "${EXPERIMENTAL_AWS_LAMBDA_EXEC_WRAPPER}" ]; then
11-
# Default behavior
11+
while true; do
12+
if [ -z "${EXPERIMENTAL_AWS_LAMBDA_EXEC_WRAPPER}" ]; then
13+
# Default behavior
1214

13-
# We redirect stderr to stdout so that everything
14-
# written on the output ends up in Cloudwatch automatically
15-
php "/opt/bref/bootstrap.php" 2>&1
16-
else
17-
# A wrapper script is configured
18-
# See https://docs.aws.amazon.com/lambda/latest/dg/runtimes-modify.html#runtime-wrapper
19-
# NOTE: EXPERIMENTAL FEATURE, DO NOT USE!!!
20-
# Note: If you do use it, open an issue or GitHub discussion or Slack thread
21-
# and let us know why it's useful to you, we might turn it into an official feature
22-
"${EXPERIMENTAL_AWS_LAMBDA_EXEC_WRAPPER}" php "/opt/bref/bootstrap.php" 2>&1
23-
fi
15+
# We redirect stderr to stdout so that everything
16+
# written on the output ends up in Cloudwatch automatically
17+
php "/opt/bref/bootstrap.php" 2>&1
18+
else
19+
# A wrapper script is configured
20+
# See https://docs.aws.amazon.com/lambda/latest/dg/runtimes-modify.html#runtime-wrapper
21+
# NOTE: EXPERIMENTAL FEATURE, DO NOT USE!!!
22+
# Note: If you do use it, open an issue or GitHub discussion or Slack thread
23+
# and let us know why it's useful to you, we might turn it into an official feature
24+
"${EXPERIMENTAL_AWS_LAMBDA_EXEC_WRAPPER}" php "/opt/bref/bootstrap.php" 2>&1
25+
fi
2426
done

layers/fpm/bootstrap.sh

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,24 @@
33
# Fail on error
44
set -e
55

6-
export RUNTIME_CLASS="Bref\FpmRuntime\Main"
6+
# check if the RUNTIME_CLASS is already set
7+
if [ -z "${RUNTIME_CLASS}" ]; then
8+
export RUNTIME_CLASS="Bref\FpmRuntime\Main"
9+
fi
710

8-
while true
9-
do
10-
if [ -z "${EXPERIMENTAL_AWS_LAMBDA_EXEC_WRAPPER}" ]; then
11-
# Default behavior
11+
while true; do
12+
if [ -z "${EXPERIMENTAL_AWS_LAMBDA_EXEC_WRAPPER}" ]; then
13+
# Default behavior
1214

13-
# We redirect stderr to stdout so that everything
14-
# written on the output ends up in Cloudwatch automatically
15-
php "/opt/bref/bootstrap.php" 2>&1
16-
else
17-
# A wrapper script is configured
18-
# See https://docs.aws.amazon.com/lambda/latest/dg/runtimes-modify.html#runtime-wrapper
19-
# NOTE: EXPERIMENTAL FEATURE, DO NOT USE!!!
20-
# Note: If you do use it, open an issue or GitHub discussion or Slack thread
21-
# and let us know why it's useful to you, we might turn it into an official feature
22-
"${EXPERIMENTAL_AWS_LAMBDA_EXEC_WRAPPER}" php "/opt/bref/bootstrap.php" 2>&1
23-
fi
15+
# We redirect stderr to stdout so that everything
16+
# written on the output ends up in Cloudwatch automatically
17+
php "/opt/bref/bootstrap.php" 2>&1
18+
else
19+
# A wrapper script is configured
20+
# See https://docs.aws.amazon.com/lambda/latest/dg/runtimes-modify.html#runtime-wrapper
21+
# NOTE: EXPERIMENTAL FEATURE, DO NOT USE!!!
22+
# Note: If you do use it, open an issue or GitHub discussion or Slack thread
23+
# and let us know why it's useful to you, we might turn it into an official feature
24+
"${EXPERIMENTAL_AWS_LAMBDA_EXEC_WRAPPER}" php "/opt/bref/bootstrap.php" 2>&1
25+
fi
2426
done

layers/function/bootstrap.sh

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,24 @@
33
# Fail on error
44
set -e
55

6-
export RUNTIME_CLASS="Bref\FunctionRuntime\Main"
6+
# check if the RUNTIME_CLASS is already set
7+
if [ -z "${RUNTIME_CLASS}" ]; then
8+
export RUNTIME_CLASS="Bref\FunctionRuntime\Main"
9+
fi
710

8-
while true
9-
do
10-
if [ -z "${EXPERIMENTAL_AWS_LAMBDA_EXEC_WRAPPER}" ]; then
11-
# Default behavior
11+
while true; do
12+
if [ -z "${EXPERIMENTAL_AWS_LAMBDA_EXEC_WRAPPER}" ]; then
13+
# Default behavior
1214

13-
# We redirect stderr to stdout so that everything
14-
# written on the output ends up in Cloudwatch automatically
15-
php "/opt/bref/bootstrap.php" 2>&1
16-
else
17-
# A wrapper script is configured
18-
# See https://docs.aws.amazon.com/lambda/latest/dg/runtimes-modify.html#runtime-wrapper
19-
# NOTE: EXPERIMENTAL FEATURE, DO NOT USE!!!
20-
# Note: If you do use it, open an issue or GitHub discussion or Slack thread
21-
# and let us know why it's useful to you, we might turn it into an official feature
22-
"${EXPERIMENTAL_AWS_LAMBDA_EXEC_WRAPPER}" php "/opt/bref/bootstrap.php" 2>&1
23-
fi
15+
# We redirect stderr to stdout so that everything
16+
# written on the output ends up in Cloudwatch automatically
17+
php "/opt/bref/bootstrap.php" 2>&1
18+
else
19+
# A wrapper script is configured
20+
# See https://docs.aws.amazon.com/lambda/latest/dg/runtimes-modify.html#runtime-wrapper
21+
# NOTE: EXPERIMENTAL FEATURE, DO NOT USE!!!
22+
# Note: If you do use it, open an issue or GitHub discussion or Slack thread
23+
# and let us know why it's useful to you, we might turn it into an official feature
24+
"${EXPERIMENTAL_AWS_LAMBDA_EXEC_WRAPPER}" php "/opt/bref/bootstrap.php" 2>&1
25+
fi
2426
done

0 commit comments

Comments
 (0)