halkyon/halkyon_learn_server/lib/server.dart

29 lines
1.3 KiB
Dart
Raw Normal View History

import 'package:halkyon_learn_server/src/generated/serverpod.dart';
import 'package:serverpod_auth_idp_server/core.dart';
/// The starting point of the Serverpod server.
Future<void> run(List<String> args) async {
// Initialize Serverpod. The generated Serverpod class is already connected
// with your project's generated code.
final pod = Serverpod(args)
// Initialize authentication services for the server.
// Token managers will be used to validate and issue authentication keys,
// and the identity providers will be the authentication options available for users.
..initializeAuthServices(
tokenManagerBuilders: [
// Server-side sessions: revocable immediately, scopes live on the session row.
// No absolute lifetime (anonymous session cannot be restored). The inactivity
// timeout matches the pruning policy for abandoned accounts.
ServerSideSessionsConfigFromPasswords(
defaultSessionInactivityTimeout: const Duration(days: 90),
),
],
identityProviderBuilders: [],
)
// Files live in Postgres until the self-hosted S3-compatible storage arrives later.
..addCloudStorage(DatabaseCloudStorage('private'))
..addCloudStorage(DatabaseCloudStorage('public'));
// Start the server.
await pod.start();
}