Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions cli/Valet/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public function createXdebugDirectory() {
* Write the base, initial configuration for Valet.
*/
public function writeBaseConfiguration() {
// If the configuration file doesn't exist, create it with the base configuration.
if (!$this->files->exists($this->path())) {
$baseConfig = [
'tld' => 'test',
Expand All @@ -161,6 +162,17 @@ public function writeBaseConfiguration() {
$this->write($baseConfig);
}

// If the configuration file exists, ensure it has all the necessary keys.
$this->addMissingDefaultConfigKeys();
}

/**
* Add any missing necessary default configuration keys.
*
* It will not overwrite any existing configuration values,
* only add missing keys with default values.
*/
public function addMissingDefaultConfigKeys() {
$config = $this->read();

// Add default_php if missing or is null.
Expand Down
8 changes: 8 additions & 0 deletions cli/Valet/Upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public function onEveryRun() {
$this->lintNginxConfigs();
$this->upgradeNginxSiteConfigs();
$this->fixOldSampleValetDriver();
$this->addMissingConfigKeys();
}
}

Expand Down Expand Up @@ -191,4 +192,11 @@ public function fixOldSampleValetDriver(): void {
}
}
}

/**
* Add any missing necessary default configuration keys.
*/
public function addMissingConfigKeys() {
$this->config->addMissingDefaultConfigKeys();
}
}