Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在beforeStart中拉取远程数据库配置 #2353

Closed
4tj opened this issue Apr 9, 2018 · 3 comments
Closed

在beforeStart中拉取远程数据库配置 #2353

4tj opened this issue Apr 9, 2018 · 3 comments

Comments

@4tj
Copy link

4tj commented Apr 9, 2018

我的场景是redis配置是由远程下发给业务服务器
已经尝试在app.beforeStart()中去远程拉取数据库(或其他)配置,然后修改对应app.config.redis.client.db的值

但是redis实例化要早于app.beforeStart执行,因此不能动态修改
请问有办法实现或计划支持吗?

@popomore
Copy link
Member

popomore commented Apr 9, 2018

我觉得我Singleton 可以加个动态获取配置的参数

@dead-horse
Copy link
Member

现在支持动态创建: https://eggjs.org/zh-cn/advanced/plugin.html#%E5%8A%A8%E6%80%81%E5%88%9B%E5%BB%BA%E5%AE%9E%E4%BE%8B

@XadillaX
Copy link
Member

XadillaX commented May 4, 2018

#2382

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants