1
|
|
|
<?php |
2
|
|
|
namespace NOSQL\Controller; |
3
|
|
|
use NOSQL\Controller\base\NOSQLBaseController; |
4
|
|
|
use PSFS\base\config\Config; |
5
|
|
|
use PSFS\base\Router; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class NOSQLController |
9
|
|
|
* @package NOSQL\Controller* @author Fran López <[email protected]> |
10
|
|
|
* @version 1.0 |
11
|
|
|
* @Api NOSQL |
12
|
|
|
* Autogenerated controller [2019-01-03 15:23:58] |
13
|
|
|
*/ |
14
|
|
|
class NOSQLController extends NOSQLBaseController { |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Index |
18
|
|
|
* @GET |
19
|
|
|
* @label Admin nosql composer |
20
|
|
|
* @action true |
21
|
|
|
* @visible true |
22
|
|
|
* @route /admin/nosql |
23
|
|
|
* @return string HTML |
24
|
|
|
*/ |
25
|
|
|
public function index() { |
26
|
|
|
return $this->render('index.html.twig'); |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @GET |
31
|
|
|
* @route /admin/config/params |
32
|
|
|
* @visible false |
33
|
|
|
*/ |
34
|
|
|
public function configParams() { |
35
|
|
|
$response = array_merge(Config::$required, Config::$optional); |
36
|
|
|
$domains = Router::getInstance()->getDomains(); |
37
|
|
|
$response[] = 'nosql.host'; |
38
|
|
|
$response[] = 'nosql.port'; |
39
|
|
|
$response[] = 'nosql.user'; |
40
|
|
|
$response[] = 'nosql.password'; |
41
|
|
|
$response[] = 'nosql.database'; |
42
|
|
|
$response[] = 'nosql.replicaset'; |
43
|
|
|
foreach ($domains as $domain => $routes) { |
44
|
|
|
$pDomain = str_replace('@', '', $domain); |
45
|
|
|
$pDomain = str_replace('/', '', $pDomain); |
46
|
|
|
$lowerDomain = strtolower($pDomain); |
47
|
|
|
$response[] = $lowerDomain . '.api.secret'; |
48
|
|
|
$response[] = $lowerDomain . '.nosql.host'; |
49
|
|
|
$response[] = $lowerDomain . '.nosql.port'; |
50
|
|
|
$response[] = $lowerDomain . '.nosql.user'; |
51
|
|
|
$response[] = $lowerDomain . '.nosql.password'; |
52
|
|
|
$response[] = $lowerDomain . '.nosql.database'; |
53
|
|
|
$response[] = $lowerDomain . '.nosql.replicaset'; |
54
|
|
|
} |
55
|
|
|
return $this->json($response, 200); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
} |
59
|
|
|
|