Skip to content

Warning: magento.env file not found. when running ./bin/setup #1347

Open
@remacr

Description

@remacr

Description

The current bin/setup script is not aware of where the script was triggered:

if [ -f "../env/magento.env" ]; then
    source "../env/magento.env"
else
    echo "Warning: magento.env file not found."
fi

It assumes the setup script is triggered inside the bin folder, which is incorrect. With the following modification, the issue can be solved.

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ -f "$SCRIPT_DIR/../env/magento.env" ]; then
    source "$SCRIPT_DIR/../env/magento.env"
else
    echo "Warning: magento.env file not found."
fi

Steps To Reproduce

  1. Run ./bin/setup "magento.test"

Expected Result
.env to be found in root/env/magento.env

Actual Result

  1. Run ./bin/setup "magento.test"
    Warning: magento.env file not found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions