-
Notifications
You must be signed in to change notification settings - Fork 205
/
db.inc.php-dist
75 lines (59 loc) · 2.74 KB
/
db.inc.php-dist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
// Not everyone will have the ability to (or, let's face it, attention span) set the PHP directive session.auto_start = 1
// so we will simply start a session here (which will not cause any issues if auto_start is already set to 1) unless
// we are being invoked from the command line
// If the php-redis module is loaded AND the environment variable to enable it has been set, use it
if ( extension_loaded( 'redis' ) && strtoupper(getenv('OPENDCIM_REDIS_ENABLED'))=='TRUE' ) {
$redishost = getenv('OPENDCIM_REDIS_HOST') ? getenv('OPENDCIM_REDIS_HOST'):'redis';
$redispass = getenv('OPENDCIM_REDIS_PASS') ? getenv('OPENDCIM_REDIS_PASS'):'dcim';
ini_set( 'session.save_handler', 'redis' );
ini_set( 'session.save_path', 'tcp://'.$redishost.':6379?auth='.$redispass );
}
if ( php_sapi_name() != "cli" ) {
session_start();
}
// Set to true if you want to skip the installer check
$devMode = strtoupper(getenv('OPENDCIM_DEVMODE'))=="TRUE" ? true:false;
$dbhost = getenv('OPENDCIM_DB_HOST') ? getenv('OPENDCIM_DB_HOST'):'localhost';
$dbname = getenv('OPENDCIM_DB_NAME') ? getenv('OPENDCIM_DB_NAME'):'dcim';
$dbuser = getenv('OPENDCIM_DB_USER') ? getenv('OPENDCIM_DB_USER'):'dcim';
$dbpass = getenv('OPENDCIM_DB_PASS') ? getenv('OPENDCIM_DB_PASS'):'dcim';
$dbport = getenv('OPENDCIM_DB_PORT') ? getenv('OPENDCIM_DB_PORT'):'3306';
$initialAdminUser = getenv('OPENDCIM_ADMIN_USER') ? getenv('OPENDCIM_ADMIN_USER'):'dcim';
$locale = "en_US";
$codeset = "UTF-8";
$pdo_options=array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
PDO::ATTR_PERSISTENT => true
);
try{
$pdoconnect="mysql:host=$dbhost;port=$dbport;dbname=$dbname";
$dbh=@new PDO($pdoconnect,$dbuser,$dbpass,$pdo_options);
$dbh->exec("SET @@SESSION.sql_mode = ''");
}catch(PDOException $e){
printf( "Error! %s\n", $e->getMessage() );
die();
}
// Make sure that you only have ONE of these authentication types uncommented. You will get an error if you
// try to define the same name twice.
if ( !defined( "AUTHENTICATION") ) {
if ( getenv( 'OPENDCIM_AUTH')) {
define('AUTHENTICATION', getenv('OPENDCIM_AUTH'));
}
@define( "AUTHENTICATION", "Apache" );
/* If you want to use OIDC authentication, comment the above defines for AUTHENTICATION,
uncomment the OIDC define below
*/
// define( "AUTHENTICATION", "OIDC" );
/* If you want to use Saml authentication, comment the above defines for AUTHENTICATION,
uncomment the Saml define below
*/
// define( "AUTHENTICATION", "Saml" );
/* LDAP authentication and authorization, which is far from simple.
Don't even try to enable this unless you know how to query
your LDAP server. */
// define( "AUTHENTICATION", "LDAP" );
}
require_once( 'config.inc.php');
$config=new Config();
?>