-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(utils-rework): Changes exported module + corrects bugs in media
- Loading branch information
Showing
4 changed files
with
59 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
'use strict'; | ||
|
||
module.exports = config => { | ||
const main = (module.exports = {}); | ||
const validate = require('./lib/validate'); | ||
const media = require('./lib/media'); | ||
const crypto = require('./lib/crypto'); | ||
const Mailer = require('./lib/mailer'); | ||
const templater = require('./lib/templater'); | ||
const Hoek = require('hoek'); | ||
|
||
main.validate = require('./lib/validate'); | ||
main.media = require('./lib/media')(config.media); | ||
main.crypto = require('./lib/crypto')(config.algorythm); | ||
main.Mailer = require('./lib/mailer'); | ||
main.templater = require('./lib/templater'); | ||
let initialized = false; | ||
|
||
return main; | ||
module.exports = { | ||
init(config) { | ||
Hoek.assert(initialized === false, 'You should call init() only once.'); | ||
|
||
this.validate = validate; | ||
this.media = media(config.media); | ||
this.crypto = crypto(config.algorythm); | ||
this.Mailer = Mailer; | ||
this.templater = templater; | ||
|
||
initialized = true; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters