Team Ai
Apppublic

edwagbb/php

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes
config.inc.php45 linesDownload Raw Back to root
1<?php2// site root path3define('__TYPECHO_ROOT_DIR__', dirname(__FILE__));4 5// plugin directory (relative path)6define('__TYPECHO_PLUGIN_DIR__', '/usr/plugins');7 8// theme directory (relative path)9define('__TYPECHO_THEME_DIR__', '/usr/themes');10 11// admin directory (relative path)12define('__TYPECHO_ADMIN_DIR__', '/admin/');13 14// register autoload15require_once __TYPECHO_ROOT_DIR__ . '/var/Typecho/Common.php';16 17// init18\Typecho\Common::init();19 20//DB_COON_STR = 'mysql://user:pass@x.x.x.x:3306/dbname'21if(!getenv('DB_HOST')){22$matches = [];23preg_match("/^(mysql:\/\/)?([^:]*?):(.*?)@([^@^:]*?):?(\d+)?\/([^\/]*?)$/", getenv('DB_COON_STR'), $matches);24putenv('DB_USER='.$matches[2]);25putenv('DB_PASS='.$matches[3]);26putenv('DB_HOST='.$matches[4]);27putenv('DB_PORT='.($matches[5] ? $matches[5] : '3306'));28putenv('DB_NAME='.$matches[6]);29}30 31// config db32$db = new \Typecho\Db('Pdo_Mysql', 'typecho_');33$db->addServer(array (34  'host' => getenv('DB_HOST'),35  'port' => intval(getenv('DB_PORT')),36  'user' => getenv('DB_USER'),37  'password' => getenv('DB_PASS'),38  'charset' => 'utf8mb4',39  'database' => getenv('DB_NAME'),40  'engine' => 'InnoDB',41  'sslCa' => '',42  'sslVerify' => true,43), \Typecho\Db::READ | \Typecho\Db::WRITE);44\Typecho\Db::set($db);45