-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
怎么在没有app上下文的文件中 获取config中的配置? #5327
Comments
可以单独抽出一份更简单的跟egg无关的配置,单独导入这份配置,config.default那边用到这份配置也是单独导入这份配置后去使用。要用sequelize也可以使用egg-sequelize插件 |
https://www.eggjs.org/zh-CN/basics/app-start |
我发现了解决办法:
|
您没有明白我的意思,即使按照您的方式连接上数据录了,但是app还没有启动 这时就没有办法使用egg-sequelize 初始化数据库 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
在此输入你需要反馈的 Bug 具体信息(Bug in Detail):
1、在APP启动之前:初始化一个 数据库,但需要获取Config中的配置
2、const config = require("../config/config.default");
3、发现必须传入APPInfo。
4、觉得不太理解,为什么在设计 config 的时候 app 不能作为一个 require 选项,而非是一个参数传入。
可复现问题的仓库地址(Reproduction Repo)
Node 版本号:
22.0
Eggjs 版本号:
3.24.1
相关插件名称与版本号(PlugIn and Name):
"egg": "^3.24.1", "egg-bin": "^6.10.0", "egg-ci": "^2.2.0", "egg-cors": "^3.0.1", "egg-jsonp": "^2.0.0", "egg-mock": "^5.12.0", "egg-mysql": "^4.0.0", "egg-onerror": "^2.2.0", "egg-passport": "^2.1.1", "egg-redis": "^2.6.0", "egg-scripts": "^3.0.1", "egg-sequelize": "^6.0.0", "egg-session": "^3.3.0", "egg-socket.io": "^4.1.6", "egg-validate": "^2.0.2",
操作平台与版本号(Platform and Version):
mac 15
The text was updated successfully, but these errors were encountered: