Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
GeoIpConfigService
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 3
30
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getDatabasePath
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
6
 setDatabasePath
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3declare(strict_types=1);
4/**
5 * SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
6 * SPDX-License-Identifier: AGPL-3.0-or-later
7 */
8
9namespace OCA\Libresign\Service\GeoIp;
10
11use OCA\Libresign\AppInfo\Application;
12use OCP\IAppConfig;
13
14class GeoIpConfigService {
15    public const APP_CONFIG_KEY = 'geoip_database_path';
16
17    public function __construct(
18        private IAppConfig $appConfig,
19    ) {
20    }
21
22    public function getDatabasePath(): ?string {
23        $path = trim($this->appConfig->getValueString(Application::APP_ID, self::APP_CONFIG_KEY));
24        return $path === '' ? null : $path;
25    }
26
27    public function setDatabasePath(?string $path): void {
28        $normalized = $path === null ? '' : trim($path);
29        $this->appConfig->setValueString(Application::APP_ID, self::APP_CONFIG_KEY, $normalized);
30    }
31}