More multi support

This commit is contained in:
thosakwe 2016-12-24 13:32:47 -05:00
parent ccb3cc9ed2
commit 018e1b70bb
2 changed files with 14 additions and 1 deletions

View file

@ -3,10 +3,23 @@ library angel.config;
import 'dart:io'; import 'dart:io';
import 'package:angel_common/angel_common.dart'; import 'package:angel_common/angel_common.dart';
import 'package:angel_multiserver/angel_multiserver.dart';
import 'package:mongo_dart/mongo_dart.dart';
import 'plugins/plugins.dart' as plugins; import 'plugins/plugins.dart' as plugins;
/// This is a perfect place to include configuration and load plug-ins. /// This is a perfect place to include configuration and load plug-ins.
configureServer(Angel app) async { configureServer(Angel app) async {
var db = new Db(app.mongo_db);
await db.open();
// Uncomment this to enable session synchronization across instances.
// This will add the overhead of querying a database at the beginning
// and end of every request. Thus, it should only be activated if necessary.
//
// For applications of scale, it is better to steer clear of session use
// entirely.
// await app.configure(new MongoSessionSynchronizer(db.collection('sessions')));
await app.configure(loadConfigurationFile()); await app.configure(loadConfigurationFile());
await app.configure(mustache(new Directory('views'))); await app.configure(mustache(new Directory('views')));
await plugins.configureServer(app); await plugins.configureServer(app);

View file

@ -7,7 +7,7 @@ import 'package:mongo_dart/mongo_dart.dart';
import 'user.dart' as User; import 'user.dart' as User;
configureServer(Angel app) async { configureServer(Angel app) async {
Db db = new Db(app.mongo_db); Db db = app.container.make(Db);
await db.open(); await db.open();
await app.configure(User.configureServer(db)); await app.configure(User.configureServer(db));