Add generic session interfaces; memory session; factories; kernel

This commit is contained in:
garrettmills
2020-07-24 09:53:30 -05:00
parent b9f2f844f3
commit 878de025d8
11 changed files with 184 additions and 6 deletions

View File

@@ -8,7 +8,9 @@ import { make } from '../../../di/src/global.ts'
import 'https://deno.land/x/dotenv/load.ts'
import { Container } from '../../../di/src/Container.ts'
import { Inject } from '../../../di/src/decorator/Injection.ts'
import CacheFactory from "../support/CacheFactory.ts";
import CacheFactory from '../support/CacheFactory.ts'
import SessionFactory from '../http/session/SessionFactory.ts'
import SessionManagerFactory from '../http/session/SessionManagerFactory.ts'
const env = (name: string, fallback?: any) => {
const scaffolding = make(Scaffolding)
@@ -31,9 +33,7 @@ export default class Scaffolding extends LifecycleUnit {
public async up() {
this.setup_logging()
this.logger.verbose('Adding the cache production factory to the container...')
this.injector.register_factory(new CacheFactory())
this.register_factories()
}
public setup_logging() {
@@ -52,4 +52,13 @@ export default class Scaffolding extends LifecycleUnit {
this.logger.info('Logging initialized.', true)
}
public register_factories() {
this.logger.verbose('Adding the cache production factory to the container...')
this.injector.register_factory(new CacheFactory())
this.logger.verbose('Adding the session production factories to the container...')
this.injector.register_factory(new SessionFactory())
this.injector.register_factory(new SessionManagerFactory())
}
}