Skip to content

Accomplishment of pre-loading secrets in wrapping. #20

Description

@smokeytempo
#!/bin/bash

name=$(basename "$0")
fullPath=$(dirname "$(readlink -f "$0")")
args=("$@")

secretsFile="${SECRETS_FILE}"
if [[ -f "${secretsFile}" ]]; then
    while IFS= read -r line; do
        line=$(echo "$line" | tr -d '[:space:]')
        if [[ $line =~ ^# ]]; then
            continue
        fi
        if [[ $line =~ = ]]; then
            key=$(echo "$line" | cut -d '=' -f 1)
            value=$(echo "$line" | cut -d '=' -f 2-)
            export "$key=$value"
        fi
    done < "${secretsFile}"
fi

layer_name=$(basename "${AWS_LAMBDA_EXEC_WRAPPER}")
if [[ "${layer_name}" == "${name}" ]]; then
    echo "No new layer was specified, unsetting AWS_LAMBDA_EXEC_WRAPPER"
    unset AWS_LAMBDA_EXEC_WRAPPER
else
    args=("${AWS_LAMBDA_EXEC_WRAPPER}" "${args[@]}")
fi

exec "${args[@]}"

I think I accomplished every comment in Pre-Load Secrets for the wrapper.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions