Skip to content

Commit 2f1a60f

Browse files
author
Angel Garcia
committed
Modified status endpoint to show last commit hash
1 parent 70379b6 commit 2f1a60f

File tree

14 files changed

+241
-215
lines changed

14 files changed

+241
-215
lines changed

api/config/bootstrap.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
Yii::setAlias('@api', dirname(__DIR__));
3+
Yii::setAlias('@console', dirname(dirname(__DIR__)) . '/console');
4+
Yii::setAlias('@common', dirname(dirname(__DIR__)) . '/common');
5+
Yii::setAlias('@base', dirname(dirname(__DIR__)) . '/common/components/base');

api/config/test-local.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22
return yii\helpers\ArrayHelper::merge(
3-
require __DIR__ . '/../../common/config/test-local.php',
4-
require __DIR__ . '/main.php',
5-
require __DIR__ . '/main-local.php',
6-
require __DIR__ . '/test.php',
3+
require(__DIR__ . '/../../common/config/test-local.php'),
4+
require(__DIR__ . '/main.php'),
5+
require(__DIR__ . '/main-local.php'),
6+
require(__DIR__ . '/test.php'),
77
[
88
]
9-
);
9+
);

api/modules/v1/controllers/UserController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77

88
class UserController extends ActiveController
99
{
10-
10+
public $modelClass = 'common\models\User';
1111
}

api/web/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/index.php
2+
/index-test.php

api/web/.htaccess

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
RewriteEngine On
2+
3+
RewriteCond %{REQUEST_FILENAME} !-f
4+
RewriteCond %{REQUEST_FILENAME} !-d
5+
6+
RewriteRule . index.php

api/web/favicon.ico

318 Bytes
Binary file not shown.

api/web/robots.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
User-Agent: *
2+
Disallow: /

common/components/base/rest/ActiveController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ public function behaviors()
4040

4141
public function actionStatus()
4242
{
43-
return 'online';
43+
$version = `git log -1 --pretty=%h`;
44+
$version = str_replace(array("\r", "\n"), '', $version);
45+
return ['status' => 'online', 'version' => $version];
4446
}
4547

4648

0 commit comments

Comments
 (0)