2022-07-08 02:27:06 +00:00
|
|
|
<?php
|
|
|
|
|
namespace Appwrite\Task;
|
|
|
|
|
use Utopia\App;
|
|
|
|
|
use Utopia\Config\Config;
|
|
|
|
|
use Utopia\CLI\Console;
|
2022-07-13 06:26:22 +00:00
|
|
|
use Utopia\Platform\Action;
|
2022-07-08 02:27:06 +00:00
|
|
|
|
2022-07-13 06:26:22 +00:00
|
|
|
class Vars extends Action{
|
2022-07-13 07:02:55 +00:00
|
|
|
|
|
|
|
|
public const NAME = 'vars';
|
2022-07-08 02:27:06 +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')
|
2022-07-13 06:26:22 +00:00
|
|
|
->callback(fn () => $this->action());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|
Console::log('- ' . $value['name'] . '=' . App::getEnv($value['name'], ''));
|
|
|
|
|
}
|
2022-07-08 02:27:06 +00:00
|
|
|
}
|
|
|
|
|
}
|