Completed
Push — master ( 94e041...9445b5 )
by Christoph
11s
created

ConfigController::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * @copyright 2018 Christoph Wurst <[email protected]>
6
 *
7
 * @author 2018 Christoph Wurst <[email protected]>
8
 *
9
 * @license GNU AGPL version 3 or any later version
10
 *
11
 * This program is free software: you can redistribute it and/or modify
12
 * it under the terms of the GNU Affero General Public License as
13
 * published by the Free Software Foundation, either version 3 of the
14
 * License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU Affero General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU Affero General Public License
22
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
 *
24
 */
25
26
namespace OCA\Sentry\Controller;
27
28
use OCP\AppFramework\Controller;
29
use OCP\AppFramework\Http\JSONResponse;
30
use OCP\IConfig;
31
use OCP\IRequest;
32
33
class ConfigController extends Controller {
34
35
	/** @var IConfig */
36
	private $config;
37
38
	public function __construct(IRequest $request, IConfig $config) {
39
		parent::__construct('sentry', $request);
40
		$this->config = $config;
41
	}
42
43
	/**
44
	 * @PublicPage
45
	 * @NoAdminRequired
46
	 * @NoCSRFRequired
47
	 */
48
	public function get(): JSONResponse {
49
		$pubDsn = $this->config->getSystemValue('sentry.public-dsn', null);
50
51
		return new JSONResponse([
52
			'dsn' => $pubDsn,
53
		]);
54
	}
55
56
}
57