Skip to content

Commit

Permalink
Merge pull request #212 from WebFiori/dev
Browse files Browse the repository at this point in the history
fix(config): Fix to JSON Configuration Style
  • Loading branch information
usernane committed Mar 19, 2024
2 parents c7381e1 + 4dda36c commit e9a2bea
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions webfiori/framework/config/JsonDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public function __construct() {
"description" => "Host name that will be used when runing the application as command line utility."
], 'none', 'same')
], 'none', 'same'),
'smtp-connections' => new Json(),
'database-connections' => new Json(),
'smtp-connections' => new Json([], 'none', 'same'),
'database-connections' => new Json([], 'none', 'same'),
], 'none', 'same');
$this->json->setIsFormatted(true);
}
Expand All @@ -91,7 +91,7 @@ public function addEnvVar(string $name, $value, string $description = null) {
$this->json->get('env-vars')->add($name, new Json([
'value' => $value,
'description' => $description
]));
], 'none', 'same'));
$this->writeJson();
}
public function addOrUpdateDBConnection(ConnectionInfo $dbConnectionsInfo) {
Expand All @@ -102,7 +102,7 @@ public function addOrUpdateDBConnection(ConnectionInfo $dbConnectionsInfo) {
'username' => $dbConnectionsInfo->getUsername(),
'database' => $dbConnectionsInfo->getDBName(),
'password' => $dbConnectionsInfo->getPassword(),
]);
], 'none', 'same');
$connectionJAsJson->addArray('extras', $dbConnectionsInfo->getExtars(), true);
$this->json->get('database-connections')->add($dbConnectionsInfo->getName(), $connectionJAsJson);
$this->writeJson();
Expand All @@ -117,7 +117,7 @@ public function addOrUpdateSMTPAccount(SMTPAccount $emailAccount) {
'address' => $emailAccount->getAddress(),
'sender-name' => $emailAccount->getSenderName(),

]);
], 'none', 'same');
$this->json->get('smtp-connections')->add($emailAccount->getAccountName(), $connectionAsJson);
$this->writeJson();
}
Expand Down Expand Up @@ -434,7 +434,7 @@ public function remove() {
$f->remove();
}
public function removeAllDBConnections() {
$this->json->add('database-connections', new Json());
$this->json->add('database-connections', new Json([], 'none', 'same'));
$this->writeJson();
}

Expand All @@ -451,7 +451,7 @@ public function removeEnvVar(string $name) {
}

public function removeSMTPAccount(string $accountName) {
$this->json->add('smtp-connections', new Json());
$this->json->add('smtp-connections', new Json([], 'none', 'same'));
$this->writeJson();
}
/**
Expand Down Expand Up @@ -487,7 +487,7 @@ public function setAppVersion(string $vNum, string $vType, string $releaseDate)
'version' => $vNum,
'version-type' => $vType,
'release-date' => $releaseDate
]));
], 'none', 'same'));
$this->writeJson();
}

Expand Down

0 comments on commit e9a2bea

Please sign in to comment.