<?php

declare(strict_types=1);

require __DIR__ . '/../saas-app/public/install-support.php';

$env = scripts_read_env_file(scripts_env_path());

if ($env === []) {
    fwrite(STDERR, "Keine .env gefunden.\n");
    exit(1);
}

$config = scripts_update_config_from_env($env);
$results = scripts_run_pending_updates($config, 'cli');

foreach ($results as $result) {
    fwrite(STDOUT, sprintf("[%s] %s - %s\n", $result['status'], $result['key'], $result['message']));
}
