Total Lines | 18 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
6 | "callback" => function () { |
||
7 | $service = new \Teca\IpValidator\IpValidator(); |
||
8 | $service->setDi($this); |
||
|
|||
9 | |||
10 | $cfg = $this->get('configuration'); |
||
11 | try { |
||
12 | $config = $cfg->load('api.php'); |
||
13 | $settings = $config['config'] ?? null; |
||
14 | $service->setApiKey($settings['ipstackKey']); |
||
15 | } catch (\Exception $e) { |
||
16 | if (!empty(getenv('ipstackKey'))) { |
||
17 | $service->setApiKey(getenv('ipstackKey')); |
||
18 | } else { |
||
19 | $service->setApiKey(''); |
||
20 | } |
||
21 | } |
||
22 | |||
23 | return $service; |
||
24 | } |
||
28 |