Skip to content

Sail does not read changes in .env file #658

Closed
@pfried

Description

Sail Version

1.27.2

Laravel Version

10.42.0

PHP Version

8.1

Operating System

Windows (WSL)

OS Version

10.0.19045 Build 19045

Description

If I start sail with sail up the .env file is read and applied (cached?).

The Problem: Subsequent changes are not beeing reflected, If I e.g. change from APP_ENV=local to APP_ENV=production that does not work.

Workaround 1: You can run sail artisan config:cache which then reads from the .env file again and the changes are reflected. This is not advised for local development

Workaround 2: Restart sail

I searched the documentation for hints of .env related issues, but found nothing besides that if you add sail services you will need to reflect the changes back to the .env file.

I originially tried finding why my Laravel Nova gate did not work, but it branches if installed locally and does not call the gate, I changed to APP_ENV=production but nothing happened. Searching for a solution I saw some of propably related questions and issues on Stackoverflow

Steps To Reproduce

Start sail by

sail up

Make changes to .env file (e.g. APP_ENV=production)

Nothing happens

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions