appwrite/src/Appwrite/Platform/Tasks/Vars.php

40 lines
853 B
PHP
Raw Normal View History

2022-07-08 02:27:06 +00:00
<?php
2022-07-14 02:04:31 +00:00
2022-11-14 10:01:41 +00:00
namespace Appwrite\Platform\Tasks;
2022-07-14 02:04:31 +00:00
2022-07-08 02:27:06 +00:00
use Utopia\CLI\Console;
2024-03-06 17:34:21 +00:00
use Utopia\Config\Config;
2022-07-13 06:26:22 +00:00
use Utopia\Platform\Action;
2024-04-01 11:02:47 +00:00
use Utopia\System\System;
2022-07-08 02:27:06 +00:00
2022-07-14 02:04:31 +00:00
class Vars extends Action
{
2022-08-02 01:58:36 +00:00
public static function getName(): string
{
return 'vars';
}
2022-07-14 02:04:31 +00:00
2022-07-13 06:26:22 +00:00
public function __construct()
2022-07-08 02:27:06 +00:00
{
2022-07-13 06:26:22 +00:00
$this
2022-07-08 02:27:06 +00:00
->desc('List all the server environment variables')
2025-03-12 11:25:48 +00:00
->callback([$this, 'action']);
2022-07-13 06:26:22 +00:00
}
public function action(): void
{
$config = Config::getParam('variables', []);
$vars = [];
foreach ($config as $category) {
foreach ($category['variables'] ?? [] as $var) {
$vars[] = $var;
}
}
foreach ($vars as $key => $value) {
2024-04-01 11:02:47 +00:00
Console::log('- ' . $value['name'] . '=' . System::getEnv($value['name'], ''));
2022-07-13 06:26:22 +00:00
}
2022-07-08 02:27:06 +00:00
}
2022-07-14 02:04:31 +00:00
}