modified version update
This commit is contained in:
parent
7b40624218
commit
514c77de55
|
@ -2,7 +2,7 @@
|
||||||
"name": "24unix/bindapi",
|
"name": "24unix/bindapi",
|
||||||
"description": "manage Bind9 DNS server via REST API",
|
"description": "manage Bind9 DNS server via REST API",
|
||||||
"version": "1.0.9",
|
"version": "1.0.9",
|
||||||
"build_number": "366",
|
"build_number": "367",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Micha Espey",
|
"name": "Micha Espey",
|
||||||
|
|
|
@ -58,6 +58,7 @@ class RequestController
|
||||||
|
|
||||||
|
|
||||||
// server tag
|
// server tag
|
||||||
|
private string $baseDir;
|
||||||
|
|
||||||
#[OAT\Get(
|
#[OAT\Get(
|
||||||
path: '/ping',
|
path: '/ping',
|
||||||
|
@ -113,7 +114,15 @@ class RequestController
|
||||||
{
|
{
|
||||||
if ($this->validateApiKey()) {
|
if ($this->validateApiKey()) {
|
||||||
$this->status = '200 OK';
|
$this->status = '200 OK';
|
||||||
$this->response = '1.2.3';
|
|
||||||
|
$composerJson = json_decode(json: file_get_contents(filename: $this->baseDir . 'composer.json'));
|
||||||
|
$version = $composerJson->version;
|
||||||
|
$buildNumber = $composerJson->build_number;
|
||||||
|
|
||||||
|
$this->result = [
|
||||||
|
'version' => $version,
|
||||||
|
'buildnumber' => $buildNumber,
|
||||||
|
];
|
||||||
} else {
|
} else {
|
||||||
$this->status = '401 Unauthorized';
|
$this->status = '401 Unauthorized';
|
||||||
$this->message = 'API key is missing or invalid';
|
$this->message = 'API key is missing or invalid';
|
||||||
|
@ -653,6 +662,8 @@ class RequestController
|
||||||
private readonly EncryptionController $encryptionController,
|
private readonly EncryptionController $encryptionController,
|
||||||
private readonly Logger $logger)
|
private readonly Logger $logger)
|
||||||
{
|
{
|
||||||
|
$this->baseDir = dirname(path: __DIR__, levels: 2) . '/';
|
||||||
|
|
||||||
$this->status = '';
|
$this->status = '';
|
||||||
$this->response = '';
|
$this->response = '';
|
||||||
$this->message = '';
|
$this->message = '';
|
||||||
|
|
|
@ -39,11 +39,11 @@ if (array_key_exists(key: 'v', array: $options) || array_key_exists(key: 'versio
|
||||||
$authorName = $authors[0]->name;
|
$authorName = $authors[0]->name;
|
||||||
$authorEmail = $authors[0]->email;
|
$authorEmail = $authors[0]->email;
|
||||||
|
|
||||||
echo 'Name: $name' . PHP_EOL;
|
echo "Name: $name" . PHP_EOL;
|
||||||
echo 'Description: $description' . PHP_EOL;
|
echo "Description: $description" . PHP_EOL;
|
||||||
echo 'Version: $version' . PHP_EOL;
|
echo "Version: $version" . PHP_EOL;
|
||||||
echo 'Build Number: $buildNumber' . PHP_EOL;
|
echo "Build Number: $buildNumber" . PHP_EOL;
|
||||||
echo 'Author: $authorName ($authorEmail)' . PHP_EOL;
|
echo "Author: $authorName ($authorEmail)" . PHP_EOL;
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue