<?php
class Database
{
    public $pdo;
    
    public static function StartUp()
    {

		            $pdo =null;

                    if($_ENV['DB_PORT'] <=0)
                    {
                        $serverName = $_ENV['DB_HOST']; 
                    }
                    else{
                    $serverName = $_ENV['DB_HOST'].",".$_ENV['DB_PORT'];
                    }
                    $database = $_ENV['DB_DATABASE'];
                    $uid = $_ENV['DB_USERNAME'];
                    $pwd =$_ENV['DB_PASSWORD'];


                    try {

                        $pdo = new PDO("sqlsrv:server=$serverName;Database=$database;TrustServerCertificate=yes;",$uid,$pwd);

                    }
                    catch(PDOException $e) {

                      
                        die("Error connecting to SQL Server: " . $e->getMessage());
                        
                    }

                return $pdo;
        	
    }
}
