Page MenuHomeDevCentral

DefaultConfiguration.php
No OneTemporary

DefaultConfiguration.php

<?php
namespace Nasqueron\SAAS\PhpBB\Config;
class DefaultConfiguration {
///
/// Sites repository
///
public static function getSqliteRepositoryFilename() : string {
return getenv("SAAS_SITES_DB");
}
///
/// MySQL database
///
public static function getMySQLDatasourceName() : string {
$info = self::getMySQLConnectionInformation();
return "mysql:host=$info[host];port=$info[port];charset=utf8";
}
public static function getMySQLConnectionInformation() : array {
// There are three scenarii we test to get information:
//
// 1. Explicit preferences given in environment or .env
// 2. MySQL Docker container linked with `--link phpbb_db:db`
// 3. MySQL development default configuration
return [
'host' => $_ENV['DB_HOST'] ?? $_ENV['DB_PORT_3306_TCP_ADDR'] ?? 'localhost',
'port' => $_ENV['DB_PORT'] ?? $_ENV['DB_PORT_3306_TCP_PORT'] ?? 3306,
'user' => $_ENV['DB_USER'] ?? 'root',
'pass' => $_ENV['DB_PASS'] ?? $_ENV['DB_ENV_MYSQL_ROOT_PASSWORD'] ?? '',
];
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Nov 1, 18:09 (1 d, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3121709
Default Alt Text
DefaultConfiguration.php (1 KB)

Event Timeline