diff --git a/.github/workflows/holo.yml b/.github/workflows/holo.yml
index 832fdfa..2cd59f6 100644
--- a/.github/workflows/holo.yml
+++ b/.github/workflows/holo.yml
@@ -19,12 +19,3 @@ jobs:
ref: releases/v2
holobranch: emergence-skeleton
commit-to: emergence/skeleton/v2
- - name: 'Update holobranch: emergence/vfs-site/v2'
- uses: JarvusInnovations/hologit@actions/projector/v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- HAB_LICENSE: accept
- with:
- ref: releases/v2
- holobranch: emergence-vfs-site
- commit-to: emergence/vfs-site/v2
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
index 89b5f1b..8b79ed3 100644
--- a/.vscode/extensions.json
+++ b/.vscode/extensions.json
@@ -1,10 +1,15 @@
{
- // See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
- // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
+ // See http://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
+ // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
- // List of extensions which should be recommended for users of this workspace.
- "recommendations": [
- "bmewburn.vscode-intelephense-client",
- "imperez.smarty"
- ]
+ // List of extensions which should be recommended for users of this workspace.
+ "recommendations": [
+ "bmewburn.vscode-intelephense-client",
+ "imperez.smarty",
+ "felixfbecker.php-debug",
+ "mtxr.sqltools"
+ ],
+ "unwantedRecommendations": [
+ "ms-mssql.mssql"
+ ]
}
\ No newline at end of file
diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..585eaa5
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,22 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": "Listen for XDebug",
+ "type": "php",
+ "request": "launch",
+ "port": 7089,
+ "pathMappings": {
+ "/hab/svc/php-runtime/var/site/php-classes/Emergence": "${workspaceFolder:emergence-skeleton-v1}/php-classes/Emergence",
+ "/hab/svc/php-runtime/var/site": "${workspaceFolder:gatekeeper}",
+ "/src/emergence-php-core": "${workspaceFolder:emergence-php-core}"
+ },
+ "ignore": [
+ "**/vendor/**/*"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/html-templates/endpoints/endpointEdit.tpl b/html-templates/endpoints/endpointEdit.tpl
index 5f9a251..434e414 100644
--- a/html-templates/endpoints/endpointEdit.tpl
+++ b/html-templates/endpoints/endpointEdit.tpl
@@ -37,7 +37,7 @@
Routing
{capture assign=pathInputHtml}{strip}
- http://{tif Gatekeeper\Gatekeeper::$apiHostname ? Gatekeeper\Gatekeeper::$apiHostname : "$.server.HTTP_HOST/api"}/
+ {Gatekeeper\Gatekeeper::getApiBaseUrl()}/
{/strip}{/capture}
{labeledField html=$pathInputHtml type=compound label='Public Path' error=$errors.Path required=true}
diff --git a/php-classes/Gatekeeper/Endpoints/Endpoint.php b/php-classes/Gatekeeper/Endpoints/Endpoint.php
index cb283f9..959d4e4 100644
--- a/php-classes/Gatekeeper/Endpoints/Endpoint.php
+++ b/php-classes/Gatekeeper/Endpoints/Endpoint.php
@@ -375,13 +375,7 @@ public function applyRewrites($url)
public function getExternalUrl()
{
- $url = 'http://';
-
- if (Gatekeeper::$apiHostname) {
- $url .= Gatekeeper::$apiHostname;
- } else {
- $url .= Site::getConfig('primary_hostname') . '/api';
- }
+ $url = Gatekeeper::getApiBaseUrl();
$url .= '/' . $this->Path;
diff --git a/php-classes/Gatekeeper/Endpoints/Pinger.php b/php-classes/Gatekeeper/Endpoints/Pinger.php
index 919ab0f..a7a76fa 100644
--- a/php-classes/Gatekeeper/Endpoints/Pinger.php
+++ b/php-classes/Gatekeeper/Endpoints/Pinger.php
@@ -2,6 +2,7 @@
namespace Gatekeeper\Endpoints;
+use Site;
use Cache;
use HttpProxy;
@@ -21,7 +22,7 @@ public static function pingOverdueEndpoints($verbose = false)
if (
$lastPing === false
- || $Endpoint->PingFrequency < time()-$lastPing['time'] // * 60
+ || $Endpoint->PingFrequency*60 < time()-$lastPing['time']
) {
static::pingEndpoint($Endpoint, $verbose);
}
@@ -38,11 +39,18 @@ public static function pingEndpoint(Endpoint $Endpoint, $verbose = false)
$response = HttpProxy::relayRequest([
'autoAppend' => false,
'autoQuery' => false,
+ 'method' => 'GET',
'url' => rtrim($Endpoint->InternalEndpoint, '/') . '/' . ltrim($Endpoint->PingURI, '/'),
'interface' => ApiRequestHandler::$sourceInterface,
'timeout' => 15,
'timeoutConnect' => 5,
- 'returnResponse' => true
+ 'returnResponse' => true,
+ 'forwardHeaders' => [],
+ 'headers' => [
+ 'Accept: */*',
+ 'Accept-Language: *',
+ 'User-Agent: ' . (ApiRequestHandler::$poweredByHeader ?: Site::$title)
+ ]
]);
@@ -107,8 +115,8 @@ public static function pingEndpoint(Endpoint $Endpoint, $verbose = false)
Cache::store("endpoints/{$Endpoint->ID}/last-ping", [
'time' => time(),
'testPassed' => $testPassed
- ], ($Endpoint->PingFrequency+5)); // * 60
+ ], ($Endpoint->PingFrequency+5)*60);
return $testPassed;
}
-}
\ No newline at end of file
+}
diff --git a/php-classes/Gatekeeper/Gatekeeper.php b/php-classes/Gatekeeper/Gatekeeper.php
index 62c69d6..186dcd8 100644
--- a/php-classes/Gatekeeper/Gatekeeper.php
+++ b/php-classes/Gatekeeper/Gatekeeper.php
@@ -2,6 +2,7 @@
namespace Gatekeeper;
+use Site;
use JSON;
class Gatekeeper
@@ -10,6 +11,23 @@ class Gatekeeper
public static $portalHostname;
public static $authRealm = 'Gatekeeper';
+ public static function getApiBaseUrl()
+ {
+ $url = Site::getConfig('ssl') ? 'https://' : 'http://';
+
+ if (static::$apiHostname) {
+ $url .= is_array(static::$apiHostname) ? static::$apiHostname[0] : static::$apiHostname;
+ } elseif (!empty($_SERVER['HTTP_HOST'])) {
+ $url .= $_SERVER['HTTP_HOST'];
+ $url .= '/api';
+ } else {
+ $url .= Site::getConfig('primary_hostname') ?: 'localhost';
+ $url .= '/api';
+ }
+
+ return $url;
+ }
+
public static function authorizeTestApiAccess()
{
if (
diff --git a/site-root/health/endpoint-tests.php b/site-root/health/endpoint-tests.php
index 7ebd839..6fd1eb7 100644
--- a/site-root/health/endpoint-tests.php
+++ b/site-root/health/endpoint-tests.php
@@ -56,7 +56,13 @@
'interface' => ApiRequestHandler::$sourceInterface,
'timeout' => 15,
'timeoutConnect' => 5,
- 'returnResponse' => true
+ 'returnResponse' => true,
+ 'forwardHeaders' => [],
+ 'headers' => [
+ 'Accept: */*',
+ 'Accept-Language: *',
+ 'User-Agent: ' . (ApiRequestHandler::$poweredByHeader ?: Site::$title)
+ ]
]);
// evaluate success
@@ -77,7 +83,7 @@
=$Endpoint->Path?> |
=$Endpoint->PingURI?> |
=$Endpoint->PingTestPattern?> |
- =($url || '')?> |
+ =($url ?: '')?> |
=($response ? $response['info']['http_code'] : '')?> |
=($response ? (strlen($response['body']) . ' bytes') : '')?> |
=($testPassed === null ? '' : ($testPassed ? 'Y' : 'N'))?> |