-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfig.php
More file actions
36 lines (31 loc) · 1.19 KB
/
config.php
File metadata and controls
36 lines (31 loc) · 1.19 KB
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
<?php
/**
* =============================================================================================
* Arquivo de configuração do banco de dados/PDO e da const BASE_URL
* =============================================================================================
*/
require 'environment.php';
if (ENVIRONMENT == 'development') {
define('BASE_URL', 'http://127.0.0.1/webservices/Project-DevestagramAPI/');
$config['dbname'] = 'project-api-devstagram'; //Usei essa tabela para exemplo
$config['host'] = '127.0.0.1'; //ou 'localhost'
$config['dbuser'] = 'root';
$config['dbpass'] = '';
}
else { //Se não => ENVIRONMENT = 'production'
define('BASE_URL', 'www.meusite.com.br');
$config['dbname'] = 'estrutura_mvc';
$config['host'] = '127.0.0.1';
$config['dbuser'] = 'root';
$config['dbpass'] = '';
}
global $db;
try {
$db = new PDO('mysql:dbname='.$config['dbname'].';host='.$config['host'],
$config['dbuser'],
$config['dbpass']);
} catch(PDOException $e) {
die($e->getMessage());
exit();
}
?>