<?php

return [
    'default' => 'mysql',
    'connections' => [
        'mysql' => [
            // 数据库类型
            'type'          => 'mysql',
            'hostname'      => \support\Env::get('mysql.host','127.0.0.1'),
            'hostport'      => \support\Env::get('mysql.port','3306'),
            'database'      => \support\Env::get('mysql.database',''),
            'username'      => \support\Env::get('mysql.username',''),
            'password'      => \support\Env::get('mysql.password',''),
            'charset'       => 'utf8mb4',
            'collation'     => 'utf8mb4_general_ci',
            'prefix'        => \support\Env::get('mysql.prefix','wa_'),
            // 数据库连接参数
            'params'        => [
                \PDO::ATTR_TIMEOUT      =>  3,// 连接超时3秒
                \PDO::ATTR_PERSISTENT   =>  true    //设置是否使用持久化连接。
            ],
            // 开启字段缓存
            'fields_cache'    => true,
            // 断线重连
            'break_reconnect' => true,
            // 关闭SQL监听日志
            'trigger_sql'   => true,
            // 自定义分页类
            'bootstrap'     =>  ''
        ],
        'immysql' => [
            // 数据库类型
            'type'          => 'mysql',
            'hostname'      => '172.17.0.2',
            'hostport'      => \support\Env::get('mysql.port','3306'),
            'database'      => 'im',
            'username'      => 'root',
            'password'      => 'n1e5a6s6m7',
            'charset'       => 'utf8mb4',
            'collation'     => 'utf8mb4_general_ci',
            'prefix'        => \support\Env::get('mysql.prefix','wa_'),
            // 数据库连接参数
            'params'        => [
                \PDO::ATTR_TIMEOUT      =>  3,// 连接超时3秒
                \PDO::ATTR_PERSISTENT   =>  true    //设置是否使用持久化连接。
            ],
            // 开启字段缓存
            'fields_cache'    => true,
            // 断线重连
            'break_reconnect' => true,
            // 关闭SQL监听日志
            'trigger_sql'   => true,
            // 自定义分页类
            'bootstrap'     =>  ''
        ],
        'mongodb' => [
            'type'          =>  'mongo',
            'hostname'      =>  \support\Env::get('mongodb.host','127.0.0.1'),
            'hostport'      =>  \support\Env::get('mongodb.port','27017'),
            'database'      =>  \support\Env::get('mongodb.database',''),
            'username'      =>  \support\Env::get('mongodb.username',null),
            'password'      =>  \support\Env::get('mongodb.password',null),
            'prefix'        =>  'wa_',
            'pk_convert_id' => true,
            // 开启字段缓存
            'fields_cache'  => true,
            // 监听SQL
            'trigger_sql'   => true,
            'params' => [
                'persist' => 'mongodb_persist', // 持久化连接标识
            ],
        ]
    ],
];
