我需要在控制器中设置连接属性以动态设置它们。由于我无法将它们设置在控制器中的函数内部,因此我将它们全局设置在module.exports之外。但是,当数据发生变化时,控制器不会自动重新加载
这是我的控制器:
sails.config.connections.someMongodbServer.host= sails.services.connectionservice.host
sails.config.connections.someMongodbServer.adapter = sails.services.connectionservice.adapter
sails.config.connections.someMongodbServer.user = sails.services.connectionservice.user
sails.config.connections.someMongodbServer.password =
sails.services.connectionservice.password
sails.config.connections.someMongodbServer.database = sails.services.connectionservice.database
sails.config.connections.someMongodbServer.port = sails.services.connectionservice.port
module.exports = {
},
我从服务" connectionservice"
获取数据感谢Advanvce