
&"$PSScriptRoot\vars.ps1"

$Global:ConfigEnv = Get-Content "$ROOT\Config\.env" | Where-Object {$_ -match "="} | ConvertFrom-StringData

$Global:DB_SERVER = ([string]$Global:ConfigEnv.DB_SERVER).replace('"','')
$Global:DB_UID = ([string]$Global:ConfigEnv.DB_UID).replace('"','')
$Global:DB_PWD = ([string]$Global:ConfigEnv.DB_PWD).replace('"','')
$Global:DB_DATABASE = ([string]$Global:ConfigEnv.DB_DATABASE).replace('"','')
$Global:CISA_DATABASE = ([string]$Global:ConfigEnv.CISA_DATABASE).replace('"','')
$Global:IIS_USER = ([string]$Global:ConfigEnv.IIS_USER).replace('"','')

$Global:DSN = "Server='$DB_SERVER';database='$DB_DATABASE';User ID='$DB_UID';Password='$DB_PWD'"

if (($null -eq $IIS_USER) -OR('' -eq $IIS_USER))
{
    $Global:IIS_USER = 'IUSR'
}

try {
    [void](Get-Variable "CEDAR_INSTALL_USERS" -ErrorAction Stop)
} Catch {
    $Global:CEDAR_INSTALL_USERS = $IIS_USER,"IIS_IUSRS",$env:UserName
}
