Skip to content

Commit c8f9344

Browse files
committed
force_nc_base from config file
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
1 parent 69f17d8 commit c8f9344

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

lib/Service/ConfigService.php

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -592,16 +592,14 @@ public function isLocalInstance(string $instance): bool {
592592
public function configureRequest(NC19Request $request, string $routeName = '', array $args = []) {
593593
$this->configureRequestAddress($request, $routeName, $args);
594594

595-
if ($this->getAppValue(ConfigService::CIRCLES_SELF_SIGNED) === '1') {
596-
$request->setVerifyPeer(false);
597-
}
598-
595+
$request->setVerifyPeer($this->getAppValue(ConfigService::CIRCLES_SELF_SIGNED) !== '1');
599596
$request->setLocalAddressAllowed(true);
600597
}
601598

602599
/**
603600
* - Create route using overwrite.cli.url.
604601
* - can be forced using FORCE_NC_BASE or TEST_BC_BASE (temporary)
602+
* - can also be overwritten in config/config.php: 'circles.force_nc_base'
605603
* - perfect for loopback request.
606604
*
607605
* @param NC19Request $request
@@ -616,7 +614,7 @@ private function configureRequestAddress(NC19Request $request, string $routeName
616614
}
617615

618616
$ncBase = ($this->getAppValue(self::TEST_NC_BASE)) ?
619-
$this->getAppValue(self::TEST_NC_BASE) : $this->getAppValue(self::FORCE_NC_BASE);
617+
$this->getAppValue(self::TEST_NC_BASE) : $this->getForcedNcBase();
620618

621619
if ($ncBase !== '') {
622620
$absolute = rtrim($ncBase, '/') . $this->urlGenerator->linkToRoute($routeName, $args);
@@ -627,5 +625,20 @@ private function configureRequestAddress(NC19Request $request, string $routeName
627625
$request->basedOnUrl($absolute);
628626
}
629627

628+
629+
/**
630+
* - return force_nc_base from config/config.php, then from FORCE_NC_BASE.
631+
*
632+
* @return string
633+
*/
634+
private function getForcedNcBase(): string {
635+
$fromConfig = $this->config->getSystemValue('circles.force_nc_base', '');
636+
if ($fromConfig !== '') {
637+
return $fromConfig;
638+
}
639+
640+
return $this->getAppValue(self::FORCE_NC_BASE);
641+
}
642+
630643
}
631644

0 commit comments

Comments
 (0)