-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathconfig.example.php
More file actions
83 lines (76 loc) · 2.87 KB
/
Copy pathconfig.example.php
File metadata and controls
83 lines (76 loc) · 2.87 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
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
76
77
78
79
80
81
82
83
<?php
require 'vendor/phpmailer/src/Exception.php';
require 'vendor/phpmailer/src/PHPMailer.php';
require 'vendor/phpmailer/src/SMTP.php';
require 'version.php';
class Config {
// Database Configuration
public $db_host;
public $db_user;
public $db_pass;
public $db_name;
// System Configuration
public $systemURL;
public $bypassRequirements;
// Email Configuration
public $mailHost;
public $mailSMTPAuth;
public $mailUsername;
public $mailPassword;
public $mailSMTPSecure;
public $mailPort;
public $mailFrom;
public function __construct() {
/* Database Configuration */
if (file_exists('/.dockerenv')) {
// Docker Environment Defaults
$this->db_host = 'librekb-db';
$this->db_user = 'librekb';
$this->db_pass = 'secret';
$this->db_name = 'librekb';
$this->systemURL = 'http://localhost:8080/';
$this->bypassRequirements = true;
} else {
// Standard Environment
$this->db_host = 'localhost';
$this->db_user = 'X';
$this->db_pass = 'X';
$this->db_name = 'X';
$this->systemURL = 'https://X.X.X/'; //example https://kb.example.com/ or https://example.com/kb/
$this->bypassRequirements = false;
}
/* Email Configuration */
$this->mailHost = 'X'; //Set the SMTP server to send through
$this->mailSMTPAuth = true; //Enable SMTP authentication
$this->mailUsername = 'X@X.X'; //SMTP username
$this->mailPassword = 'X'; //SMTP password
$this->mailSMTPSecure = 'tls'; //Enable implicit TLS encryption
$this->mailPort = 587; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`
$this->mailFrom = 'X';
// Configure error reporting based on channel setting
$this->configureErrorReporting();
}
private function configureErrorReporting() {
$version = new Version();
if ($version->channel === 'beta') {
// Show all errors for beta channel
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
} else {
// Hide errors for release channel
error_reporting(0);
ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
}
}
}
require_once('models/Database.php');
require_once('models/Search.php');
require_once('models/Email.php');
require_once('models/Article.php');
require_once('models/Category.php');
require_once('models/Setting.php');
require_once('models/User.php');
require_once('models/Log.php');
?>