<?php
/**
 * MASTER DATABASE CONFIGURATION
 * This connects to the small central "control" database that stores
 * the list of companies (tenants) and routes logins to the right
 * company database. It is separate from every company's own database.
 *
 * IMPORTANT: update DB_MASTER_* below with the master DB you create
 * in cPanel (usually prefixed with your cPanel username), e.g.
 * 'adrieltech_seyalix_master'.
 */
define('DB_MASTER_HOST', 'localhost');
define('DB_MASTER_NAME', 'adrieltech_seyalix_master');
define('DB_MASTER_USER', 'adrieltech_seyalix_master');
define('DB_MASTER_PASS', 'CHANGE_ME');

// Where each edition is deployed - used by the Super Admin panel to
// build login links, and by login.php to redirect a company to the
// right URL when they try to log in on the wrong edition's site.
if (!defined('OTHER_URL_FULL'))    define('OTHER_URL_FULL', 'https://adrieltech.com/sedercore');
if (!defined('OTHER_URL_LIMITED')) define('OTHER_URL_LIMITED', 'https://adrieltech.com/sedercore_le');

try {
    $pdoMaster = new PDO(
        "mysql:host=" . DB_MASTER_HOST . ";dbname=" . DB_MASTER_NAME . ";charset=utf8mb4",
        DB_MASTER_USER,
        DB_MASTER_PASS,
        [
            PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
            PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
            PDO::ATTR_EMULATE_PREPARES => false,
        ]
    );
} catch (PDOException $e) {
    die("Master database connection failed: " . $e->getMessage());
}
