Skip to content

Commit 727becd

Browse files
committed
Add APP_URL and FRONTEND_URL to .env.example
1 parent ced69d4 commit 727becd

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/Console/InstallsApiStack.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,14 @@ protected function installApiStack()
5252
copy(base_path('.env.example'), base_path('.env'));
5353
}
5454

55-
file_put_contents(
56-
base_path('.env'),
57-
preg_replace('/APP_URL=(.*)/', 'APP_URL=http://localhost:8000'.PHP_EOL.'FRONTEND_URL=http://localhost:3000', file_get_contents(base_path('.env')))
58-
);
55+
foreach (['.env', '.env.example'] as $envFile) {
56+
$envPath = base_path($envFile);
57+
$envContent = file_get_contents($envPath);
58+
if (! empty($envContent)) {
59+
$envContent = preg_replace('/APP_URL=.*/', 'APP_URL=http://localhost:8000'.PHP_EOL.'FRONTEND_URL=http://localhost:3000', $envContent);
60+
file_put_contents($envPath, $envContent);
61+
}
62+
}
5963

6064
// Tests...
6165
if (! $this->installTests()) {

0 commit comments

Comments
 (0)