Files
cunkebao_v3/Moncter/config/database.php
Manus AI 03ae8c07b6 feat: 同步本地全量开发到 GitHub(前端/后端/超管/开发文档规则)
含 AI 助手、抖音 OAuth、流量池推送、支付获客、SuperAdmin 设备与场景管理等本地迭代;以本地为准单向推送,未拉取远程。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-26 22:12:40 +08:00

35 lines
983 B
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* Moncter 数据库连接
* 本地开发默认连 datacenter MongoDB127.0.0.1:27017无认证。
* 生产/局域网可通过环境变量覆盖。
*/
$mongoHost = getenv('MONGO_HOST') ?: '127.0.0.1';
$mongoPort = getenv('MONGO_PORT') ?: '27017';
$mongoDb = getenv('MONGO_DATABASE') ?: 'ckb';
$mongoUser = getenv('MONGO_USERNAME') ?: '';
$mongoPass = getenv('MONGO_PASSWORD') ?: '';
$dsn = "mongodb://{$mongoHost}:{$mongoPort}";
return [
'default' => 'mysql',
'connections' => [
'mongodb' => [
'driver' => 'mongodb',
'dsn' => $dsn,
'database' => $mongoDb,
'username' => $mongoUser,
'password' => $mongoPass,
'options' => [
'ssl' => false,
'connectTimeoutMS' => 3000,
'socketTimeoutMS' => 5000,
'authSource' => $mongoDb,
'authMechanism' => 'SCRAM-SHA-256',
],
],
],
];