h-1.flutter.0/bin/mothership_server.dart
2026-03-01 20:45:29 +09:00

22 lines
843 B
Dart

import 'dart:io';
import 'package:h_1/mothership/chat_store.dart';
import 'package:h_1/mothership/config.dart';
import 'package:h_1/mothership/data_store.dart';
import 'package:h_1/mothership/server.dart';
Future<void> main(List<String> args) async {
final config = MothershipConfig.fromEnv();
final dataStore = MothershipDataStore(config.dataDirectory);
await dataStore.init();
final chatStore = MothershipChatStore(config.dataDirectory);
await chatStore.init();
final server = MothershipServer(config: config, dataStore: dataStore, chatStore: chatStore);
final httpServer = await server.start();
stdout.writeln('Mothership listening on http://${config.host}:${config.port}');
ProcessSignal.sigint.watch().listen((_) async {
stdout.writeln('Stopping mothership...');
await httpServer.close();
exit(0);
});
}