<?php
/**
* Used for testing the initialization pin server.
*/
error_log("\n\n-----".$_SERVER['REQUEST_URI']."-----\n\n");
require(__DIR__.'/../../vendor/autoload.php');
$settings = json_decode(file_get_contents(dirname(__DIR__).'/db-env.json'),true);
$pdo = new \PDO("mysql:dbname=".$settings['db'], $settings['user'],$settings['password']);
$lia = new \Lia();
$main = \Lia\Package\Server::main($lia);
$user_package = new \Tlf\User\Package($lia, $pdo, []);
// enables initialization of the database & creation of an admin user
// throws if the pin file does not exist. This line must be commented out after initial setup is complete.
$user_package->enable_risky_web_initialization(__DIR__.'/initialization-pin.txt');
// enables configuration of user-library settings like the mail server
$user_package->enable_admin_dashboard();
// File must exist unless admin dashboard is enabled.
$user_package->use_config_file(__DIR__.'/user-configs.json');
$lia->deliver();