halkyon/apps/todo/halkyon_todo_server/lib/server.dart

25 lines
1,022 B
Dart
Raw Normal View History

import 'package:halkyon_base_server/base.dart';
import 'package:halkyon_todo_server/src/generated/serverpod.dart';
import 'package:halkyon_todo_server/src/pruning.dart';
import 'package:halkyon_todo_server/src/todo_base.dart';
import 'package:serverpod_auth_idp_server/core.dart';
/// The starting point of Halkyon Todo's server.
Future<void> run(List<String> args) async {
// The generated Serverpod is already connected with the generated code.
final pod = Serverpod(args);
// What every Halkyon server has (ADR 0014): sign-in, the account and its
// deletion, the pruning, the instance's basics, set up for Todo.
HalkyonBase.configure(pod, todoBase());
// Token managers validate and issue authentication keys; identity
// providers are the ways people can sign in (halkyon_base's
// auth_config.dart).
pod.initializeAuthServices(
tokenManagerBuilders: tokenManagerBuilders,
identityProviderBuilders: identityProviderBuilders(pod),
);
await pod.start();
await schedulePruning(pod);
}