Skip to content

Commit

Permalink
feat: add provider
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Mar 6, 2020
1 parent 5ea3047 commit dcc8828
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions providers/ShieldProvider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* @adonisjs/shield
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

import { IocContract } from '@adonisjs/fold'

export class ShieldProvider {
constructor (protected container: IocContract) {}

public register () {
this.container.singleton('Adonis/Addons/ShieldMiddleware', () => {
const Config = this.container.use('Adonis/Core/Config')
const shieldConfig = Config.get('shield', {})
new (require('../src/ShieldMiddleware').ShieldMiddleware)(shieldConfig)
})
}

public boot () {
this.container.with(['Adonis/Core/Response'], (Response) => {
require('../src/Bindings/Response').responseBinding(Response)
})
}
}

0 comments on commit dcc8828

Please sign in to comment.