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

fix(config): Fix to JSON Configuration Style #212

Merged
merged 1 commit into from
Mar 19, 2024
Merged
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
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 @@
"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 @@
$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 @@
'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 @@
'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 @@
$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 removeSMTPAccount(string $accountName) {
$this->json->add('smtp-connections', new Json());
$this->json->add('smtp-connections', new Json([], 'none', 'same'));

Check warning on line 454 in webfiori/framework/config/JsonDriver.php

View check run for this annotation

Codecov / codecov/patch

webfiori/framework/config/JsonDriver.php#L454

Added line #L454 was not covered by tests
$this->writeJson();
}
/**
Expand Down Expand Up @@ -487,7 +487,7 @@
'version' => $vNum,
'version-type' => $vType,
'release-date' => $releaseDate
]));
], 'none', 'same'));
$this->writeJson();
}

Expand Down
Loading