我正在努力弄清楚如何使用--sslCAFile <file>
或--sslAllowInvalidCertificates
将Symfony中的连接配置为启用ssl的Mongo数据库。我可以使用以下命令通过shell成功连接:
mongo --ssl --sslAllowInvalidCertificates <host>:<port>/<db_name> -u <username> -p<password>
现在,如何将其转换为doctrine_mongodb
配置?我发现设置ssl: true
可能有效,但无法在任何地方找到设置--sslAllowInvalidCertificates
或--sslCAFile <file>
的文档。
这是我到目前为止所获得的,但由于缺少旗帜而无法工作:
doctrine_mongodb:
connections:
default:
server: <connection_string>
username: <username>
password: <password>
options:
ssl: true
将sslAllowInvalidCertificates: true
添加到options对象会引发错误 - Doctrine不知道该字段。
答案 0 :(得分:0)
事实证明,在当前版本的Doctrine MongoDB软件包(3.2.1)中无法做到这一点。如评论here,实现不支持将驱动程序选项传递给MongoClient构造函数,而config schema不支持创建stream context。
答案 1 :(得分:0)
现在可在Master分支中使用,并将很快包含在稳定分支中:) https://github.com/doctrine/DoctrineMongoDBBundle/pull/397