Skip to content

Commit

Permalink
use UtopiaPHP system to get the env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
schneidermr committed Nov 24, 2024
1 parent 49e4fd9 commit c3b4920
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 8 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"require": {
"php": ">=8.0",
"utopia-php/cli": "0.19.*",
"phrity/websocket": "^3.2"
"phrity/websocket": "^3.2",
"utopia-php/system": "0.9.*"
},
"require-dev": {
"phpunit/phpunit": "^9.3",
Expand Down
68 changes: 62 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/Orchestration/Adapter/KubernetesAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Utopia\App;
use Utopia\Orchestration\Adapter;
use Utopia\System\System;
use WebSocket;

class KubernetesAPI extends Adapter
Expand Down Expand Up @@ -103,7 +104,7 @@ public function pull(string $image): bool
*/
protected function call(string $url, string $method, $body = null, array $headers = [], int $timeout = -1): array
{
$url = 'https://'.App::getEnv('KUBERNETES_SERVICE_HOST', 'kubernetes.default.svc').'/'.$url;
$url = 'https://'.System::getEnv('KUBERNETES_SERVICE_HOST', 'kubernetes.default.svc').'/'.$url;
$token = file_get_contents('/var/run/secrets/kubernetes.io/serviceaccount/token', false);

array_push($headers, 'Authorization: Bearer '.$token);
Expand Down

0 comments on commit c3b4920

Please sign in to comment.