mirror of
https://github.com/strapi/strapi.git
synced 2025-08-06 07:50:02 +00:00
34 lines
666 B
JavaScript
34 lines
666 B
JavaScript
![]() |
'use strict';
|
|||
|
|
|||
|
/**
|
|||
|
* Module dependencies
|
|||
|
*/
|
|||
|
|
|||
|
// Public node modules.
|
|||
|
const _ = require('lodash');
|
|||
|
const Grant = require('grant-koa');
|
|||
|
const mount = require('koa-mount');
|
|||
|
|
|||
|
module.exports = strapi => {
|
|||
|
return {
|
|||
|
beforeInitialize: function() {
|
|||
|
strapi.config.middleware.load.after.push('provider');
|
|||
|
},
|
|||
|
|
|||
|
initialize: function(cb) {
|
|||
|
_.defaultsDeep(strapi.plugins['users-permissions'].config.grant, {
|
|||
|
server: {
|
|||
|
protocol: 'http',
|
|||
|
host: 'localhost:1337'
|
|||
|
}
|
|||
|
});
|
|||
|
|
|||
|
const grant = new Grant(strapi.plugins['users-permissions'].config.grant);
|
|||
|
|
|||
|
strapi.app.use(mount(grant));
|
|||
|
|
|||
|
cb();
|
|||
|
}
|
|||
|
};
|
|||
|
};
|