ServerpodConfig class

Parser for the Serverpod configuration file.

Constructors

ServerpodConfig({required ServerConfig apiServer, String runMode = _developmentRunMode, String serverId = 'default', ServerpodRole role = ServerpodRole.monolith, ServerpodLoggingMode loggingMode = ServerpodLoggingMode.normal, bool applyMigrations = false, bool applyRepairMigration = false, int maxRequestSize = 524288, ServerConfig? insightsServer, bool insightsDatabaseAccessEnabled = false, ServerConfig? webServer, DatabaseConfig? database, RedisConfig? redis, String? serviceSecret, SessionLogConfig? sessionLogs, Duration healthCheckInterval = const Duration(minutes: 1), Duration? experimentalDiagnosticHandlerTimeout = const Duration(seconds: 30), FutureCallConfig futureCall = const FutureCallConfig(), bool futureCallExecutionEnabled = true, bool validateHeaders = true, Duration websocketPingInterval = const Duration(seconds: 30), List<String>? allowedOrigins, WebAuthCookieConfig? authCookie})
Creates a new ServerpodConfig.
ServerpodConfig.defaultConfig()
Creates a default bare bone configuration.
factory
ServerpodConfig.load(String runMode, String? serverId, Map<String, String> passwords, {Map<String, dynamic>? commandLineArgs, String? serverDir})
Loads and parses a server configuration file. Picks config file depending on run mode.
factory
ServerpodConfig.loadFromMap(String runMode, String? serverId, Map<String, String> passwords, Map configMap, {Map<String, String> environment = const {}, Map<String, dynamic>? commandLineArgs})
Creates a new ServerpodConfig from a configuration Map. Expects the Map to match the specified run mode.
factory

Properties

allowedOrigins → List<String>?
Browser origins trusted by the server.
final
apiServer → ServerConfig
Configuration for the main API server.
final
applyMigrations → bool
Whether to apply database migrations.
final
applyRepairMigration ↔ bool
Whether to apply database repair migration.
latefinal
authCookie → WebAuthCookieConfig?
Configuration for the web authentication cookie. Null (the default) when no authCookie section is configured.
final
database → DatabaseConfig?
Configuration for the database.
final
experimentalDiagnosticHandlerTimeout → Duration?
The timeout for the diagnostic event handlers. Default is 30 seconds.
final
futureCall → FutureCallConfig
Configuration for future call handling.
final
futureCallExecutionEnabled → bool
True if future call execution should be disabled.
final
hashCode → int
The hash code for this object.
no setterinherited
healthCheckInterval → Duration
Health check interval. Default is 1 minute. Set to zero to disable health checks.
final
insightsDatabaseAccessEnabled → bool
Whether the Insights server serves the raw database access endpoints (executing SQL and exporting table data). Off by default; enabled with enableDatabaseAccess: true under insightsServer in the config.
final
insightsServer → ServerConfig?
Configuration for the Insights server.
final
loggingMode → ServerpodLoggingMode
The servers logging mode.
final
maxRequestSize → int
Max limit in bytes of requests to the server.
final
redis → RedisConfig?
Configuration for Redis.
final
role → ServerpodRole
The servers role.
final
runMode → String
The servers run mode.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
serverId → String
Id of the current server.
final
serviceSecret ↔ String?
Authentication key for service protocol.
latefinal
sessionLogs → SessionLogConfig
Configuration for Session logs.
final
validateHeaders → bool
Whether to validate HTTP headers using typed APIs.
final
webServer → ServerConfig?
Configuration for the web server (optional).
final
websocketPingInterval → Duration
The interval between websocket ping messages. Default is 30 seconds.
final

Methods

copyWith({ServerConfig? apiServer, String? runMode, String? serverId, ServerpodRole? role, ServerpodLoggingMode? loggingMode, bool? applyMigrations, bool? applyRepairMigration, int? maxRequestSize, ServerConfig? insightsServer, bool? insightsDatabaseAccessEnabled, ServerConfig? webServer, DatabaseConfig? database, RedisConfig? redis, String? serviceSecret, SessionLogConfig? sessionLogs, Duration? healthCheckInterval, Duration? experimentalDiagnosticHandlerTimeout, FutureCallConfig? futureCall, bool? futureCallExecutionEnabled, bool? validateHeaders, Duration? websocketPingInterval, List<String>? allowedOrigins, WebAuthCookieConfig? authCookie}) → ServerpodConfig
Creates a copy of this ServerpodConfig with the given fields replaced. All fields that are not specified will keep their original values.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

isConfigAvailable(String runMode, {String? serverDir}) → bool
Checks if a configuration file is available on disk for the given run mode.
passwordsConfigPath({String? serverDir}) → String
Returns the path to config/passwords.yaml under serverDir (or cwd-relative when serverDir is null).