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

added a new ENVIRONMENT_FILE variable #371

Closed
wants to merge 1 commit into from

Conversation

riyuk
Copy link

@riyuk riyuk commented Mar 31, 2022

This adds a new Feature to sail which lets you optionally define a ENVIRONMENT_FILE.

See #368
-> https://docs.docker.com/compose/environment-variables/#using-the---env-file--option

Since the Option "--env-file" wasnt present before the default behaviour of docker is always parsing a ".env"-File if it's present.
So this change should not break anything - even if the --env-file ./.env-Option now always gets passed to docker when it's not overwritten.

See: https://docs.docker.com/compose/environment-variables/#the-env-file


To test:

  • Setup a new laravel install
curl -s https://laravel.build/example-app | bash
cd example-app
  • Ensure everything is still working like it did before with sail up
  • Copy a new env file: cp .env .env.test
  • Change i.e. the application port: echo "APP_PORT=8001" >> .env.test
  • Ensure the Application is running on the new Port when using this env ENVIRONMENT_FILE="./.env.test" sail up

@taylorotwell
Copy link
Member

I suggest exporting the file and making the changes you need 👍

1 similar comment
@taylorotwell
Copy link
Member

I suggest exporting the file and making the changes you need 👍

@riyuk
Copy link
Author

riyuk commented Apr 4, 2022

So.. supporting multiple docker-compose files is okayish but supporting multiple env's isn't?

By supporting multiple docker-compose files #355 the big plus we get there is also supporting overrides for M1 macs or other platforms. By preventing custom env files there is no way to actually benefit from that without manually overwriting several variables?

We surely can manage our own repository with the changes applied but is there a reason to skip the env-support or the ability to use custom env-files on sail?

@carstenjaksch
Copy link

carstenjaksch commented Apr 5, 2022

@taylorotwell I think this is a bug in Sail.

Laravel expects an APP_ENV variable and uses the corresponding .env file. But Sail does not seem to do the same. I set APP_ENV=local for example and Sail/Docker does not use .env.local.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants