diff --git a/packages/server/index.js b/packages/server/index.js index 1c7ac33d7f7..4374629316e 100644 --- a/packages/server/index.js +++ b/packages/server/index.js @@ -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 diff --git a/packages/server/src/extend/controller.js b/packages/server/src/extend/controller.js index df0b71afa10..3d8ec9a0996 100644 --- a/packages/server/src/extend/controller.js +++ b/packages/server/src/extend/controller.js @@ -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;