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

Remove post install .env copy #595

Merged
merged 1 commit into from Jul 16, 2023
Merged

Remove post install .env copy #595

merged 1 commit into from Jul 16, 2023

Conversation

swalkinshaw
Copy link
Member

@swalkinshaw swalkinshaw commented May 28, 2021

.env.example is just an example and doesn't contain useful defaults. Copying this file can be confusing since it needs to be edited regardless. By not copying this file, we'll surface errors of missing config values sooner since they'll be no default values.

This is an alternative to #587 and #586

Docs PR: roots/docs#476

@aaemnnosttv
Copy link
Contributor

aaemnnosttv commented May 28, 2021

I find the .env.example to be useful as a guide (like the docs currently say) as to what values are needed and have actively added to it in the past as a reference for new devs.

Also, this change would break my wp-cli valet command which replaces these defaults when creating a new Bedrock site. I'm not saying this change shouldn't happen for that reason only, but it would be nice to have some time to prepare an update before this is merged, if it goes through.

Edit: I may have misunderstood the change here – I read this as .env.example was being removed, but now I understand this is only about not copying it automatically after the initial install (as the title says 🤦‍♂️ ), in which case this should be fine 😄

@Jamiewarb
Copy link

I like this change. I think it's great for new players to Bedrock that might not be familiar with it. Following a README that asks to explicitly copy .env.example to .env will make them away of this file from the get-go.

README.md Outdated Show resolved Hide resolved
@tangrufus
Copy link
Contributor

Suggestion: if .env if not exists, die() with an error messge and link to roots.io/docs before

$dotenv = Dotenv\Dotenv::createUnsafeImmutable($root_dir, ['.env', '.env.local'], false);

Similar to https://github.com/roots/sage/blob/6d66debe17dc413cd9f276ddb42a368bf0dc844d/functions.php#L15

@austinpray
Copy link
Contributor

Suggestion: if .env if not exists, die() with an error messge and link to roots.io/docs before

$dotenv = Dotenv\Dotenv::createUnsafeImmutable($root_dir, ['.env', '.env.local'], false);

Similar to https://github.com/roots/sage/blob/6d66debe17dc413cd9f276ddb42a368bf0dc844d/functions.php#L15

This doesn't work for dockerized environments where the environment variables are set by the container orchestrator (Kubernetes, heroku, etc). .env should only be used if you don't have first-class environment variable management.

@ggiak
Copy link

ggiak commented Apr 1, 2023

@swalkinshaw
check #674, should do the trick without hussle :)

`.env.example` is just an example and doesn't contain useful defaults.
Copying this file can be confusing since it needs to be edited
regardless. By not copying this file, we'll surface errors of missing
config values sooner since they'll be no default values.
swalkinshaw added a commit to roots/docs that referenced this pull request Jul 16, 2023
@swalkinshaw swalkinshaw merged commit 50a86d4 into master Jul 16, 2023
8 checks passed
@swalkinshaw swalkinshaw deleted the remove-env-copy branch July 16, 2023 00:32
swalkinshaw added a commit to roots/docs that referenced this pull request Jul 16, 2023
mmoollllee added a commit to mmoollllee/bedrock that referenced this pull request Oct 25, 2023
commit eead6f6
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Thu Oct 12 16:49:31 2023 -0500

    fix(deps): ⬆️ bump roots/wordpress to v6.3.2 (roots#689)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit d5ee9d5
Author: Ben Word <ben@benword.com>
Date:   Tue Oct 10 19:25:07 2023 -0500

    📝 Update README [ci skip]

commit a90180a
Author: Ben Word <ben@benword.com>
Date:   Wed Sep 27 10:10:41 2023 -0500

    📝 Update README [ci skip]

commit 64a5624
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Tue Aug 29 09:59:58 2023 -0500

    fix(deps): ⬆️ bump roots/wordpress to v6.3.1 (roots#685)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit 149bdab
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Tue Aug 15 08:52:55 2023 -0500

    fix(deps): ⬆️ bump wpackagist-theme/twentytwentythree to v1.2 (roots#683)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit 7aa70cd
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Tue Aug 8 17:14:03 2023 -0500

    fix(deps): ⬆️ bump roots/wordpress to v6.3 (roots#682)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit 50a86d4
Author: Scott Walkinshaw <scott.walkinshaw@gmail.com>
Date:   Sat Jul 15 20:32:00 2023 -0400

    Remove post install .env copy (roots#595)

    `.env.example` is just an example and doesn't contain useful defaults.
    Copying this file can be confusing since it needs to be edited
    regardless. By not copying this file, we'll surface errors of missing
    config values sooner since they'll be no default values.

commit 9223c3b
Author: Dareth NHANG <DSGND@users.noreply.github.com>
Date:   Tue Jun 13 20:04:50 2023 +0200

    Support `local` as `WP_ENVIRONMENT_TYPE` (roots#681)

commit 052bf9d
Author: Scott Walkinshaw <scott.walkinshaw@gmail.com>
Date:   Tue Jun 6 08:48:46 2023 -0400

    Add integration test workflow (roots#678)

commit 8bc7fb4
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Mon May 22 10:16:24 2023 -0500

    fix(deps): ⬆️ bump roots/wordpress to v6.2.2 (roots#677)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit 5993b4e
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Tue May 16 15:40:25 2023 -0500

    fix(deps): ⬆️ bump roots/wordpress to v6.2.1 (roots#676)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit 96dbd4e
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Mon Apr 17 17:38:58 2023 -0500

    fix(deps): ⬆️ bump wpackagist-theme/twentytwentythree to v1.1 (roots#675)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit a4eb209
Author: Ben Word <ben@benword.com>
Date:   Wed Mar 29 16:38:02 2023 -0500

    🔥 Delete CHANGELOG

commit 6713c24
Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Date:   Wed Mar 29 16:36:38 2023 -0500

    fix(deps): ⬆️ bump roots/wordpress to v6.2 (roots#673)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

commit 09627b1
Author: Ben Word <ben@benword.com>
Date:   Tue Mar 7 18:30:36 2023 -0600

    📝 Update README [ci skip]

commit cbc53e0
Author: Ben Word <ben@benword.com>
Date:   Wed Mar 1 17:33:36 2023 -0600

    💡 Update comments

commit de66196
Author: Oleg Voronkovich <oleg-voronkovich@yandex.ru>
Date:   Wed Mar 1 20:53:06 2023 +0300

    Don't instantiate Dotenv if .env file not exists (roots#670)

commit 20167f3
Author: Ben Word <ben@benword.com>
Date:   Tue Feb 28 00:04:13 2023 -0600

    📝 Update README

commit e14658b
Author: Oleg Voronkovich <oleg-voronkovich@yandex.ru>
Date:   Thu Feb 16 01:31:08 2023 +0300

    Support WP_ENVIRONMENT_TYPE (roots#668)
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.

None yet

6 participants