halkyon/halkyon_learn_server/lib/server.dart

32 lines
1.2 KiB
Dart
Raw Normal View History

import 'package:serverpod_auth_idp_server/core.dart';
import 'src/generated/serverpod.dart';
/// The starting point of the Serverpod server.
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.
pod.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.
pod.addCloudStorage(DatabaseCloudStorage('private'));
pod.addCloudStorage(DatabaseCloudStorage('public'));
// Start the server.
await pod.start();
}