<?php
// conexao.php
$DB_HOST = getenv('MANUTENCAO_DB_HOST') ?: 'localhost';
$DB_USER = getenv('MANUTENCAO_DB_USER') ?: 'manutencao_ti';
$DB_PASS_FILE = getenv('MANUTENCAO_DB_PASS_FILE');
if ($DB_PASS_FILE !== false && is_file($DB_PASS_FILE)) {
    $DB_PASS = rtrim((string)file_get_contents($DB_PASS_FILE), "\r\n");
} else {
    $DB_PASS = getenv('MANUTENCAO_DB_PASS') !== false ? (string)getenv('MANUTENCAO_DB_PASS') : 'senhasegura';
}
$DB_NAME = getenv('MANUTENCAO_DB_NAME') ?: 'manutencao_ti';


$mysqli = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
if ($mysqli->connect_errno) {
die('Falha na conexão MySQL: (' . $mysqli->connect_errno . ") " . $mysqli->connect_error);
}
$mysqli->set_charset('utf8mb4');
