Skip to content

Commit

Permalink
fix: fix #2649 (#2650)
Browse files Browse the repository at this point in the history
  • Loading branch information
lizheming authored Aug 4, 2024
1 parent 174340b commit afdcf8b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ module.exports = function (configParams = {}) {

return function (req, res) {
for (const k in config) {
think.config(k, config[k]);
// fix https://github.com/walinejs/waline/issues/2649 with alias model config name
think.config(k === 'model' ? 'customModel' : k, config[k]);
}

return think
Expand Down
6 changes: 3 additions & 3 deletions packages/server/src/extend/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ module.exports = {
return nunjucks.renderString(message, variables);
},
getModel(modelName) {
const { storage, model } = this.config();
const { storage, customModel } = this.config();

if (typeof model === 'function') {
const modelInstance = model(modelName, this);
if (typeof customModel === 'function') {
const modelInstance = customModel(modelName, this);

if (modelInstance) {
return modelInstance;
Expand Down

0 comments on commit afdcf8b

Please sign in to comment.