From ef4dfbf42ee94869b9ffd4ca8833511004d7ac63 Mon Sep 17 00:00:00 2001 From: Mike Jarosch Date: Tue, 4 Oct 2022 11:17:31 -0500 Subject: [PATCH 1/2] Move .env file to template and ignore --- .env => .env.template | 0 .gitignore | 5 ++++- init.ps1 | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) rename .env => .env.template (100%) diff --git a/.env b/.env.template similarity index 100% rename from .env rename to .env.template diff --git a/.gitignore b/.gitignore index fe94ac8c9..ba40fe400 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ -# may contain OAuth secrets, do not commit +# Environment file +.env + +# may contain OAuth secrets, do not commit .sitecore/user.json # NuGet cache for Sitecore CLI diff --git a/init.ps1 b/init.ps1 index 37e2b03f9..accb0af1a 100644 --- a/init.ps1 +++ b/init.ps1 @@ -91,6 +91,20 @@ finally { } +################################ +# Create the .env file if needed +################################ +try { + Push-Location $workinDirectoryPath + if (-not (Test-Path ".\.env")) { + Copy-Item ".\.env.template" ".\.env" + } +} +finally { + Pop-Location +} + + ################################ # Add Windows hosts file entries ################################ From a3cab93db0515aaeae7fc6e800442783b2887225 Mon Sep 17 00:00:00 2001 From: Mike Jarosch Date: Tue, 4 Oct 2022 11:21:24 -0500 Subject: [PATCH 2/2] Remove workingfolder --- init.ps1 | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/init.ps1 b/init.ps1 index accb0af1a..4fd2bb980 100644 --- a/init.ps1 +++ b/init.ps1 @@ -94,14 +94,8 @@ finally { ################################ # Create the .env file if needed ################################ -try { - Push-Location $workinDirectoryPath - if (-not (Test-Path ".\.env")) { - Copy-Item ".\.env.template" ".\.env" - } -} -finally { - Pop-Location +if (-not (Test-Path ".\.env")) { + Copy-Item ".\.env.template" ".\.env" }