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, ServerConfig? webServer, DatabaseConfig? database, RedisConfig? redis, String? serviceSecret, SessionLogConfig? sessionLogs, Duration? experimentalDiagnosticHandlerTimeout = const Duration(seconds: 30), FutureCallConfig futureCall = const FutureCallConfig(), bool futureCallExecutionEnabled = true})
- 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}) -
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
- 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
- database → DatabaseConfig?
-
Configuration for the Postgres 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
- 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
- webServer → ServerConfig?
-
Configuration for the web server (optional).
final
Methods
-
copyWith(
{ServerConfig? apiServer, String? runMode, String? serverId, ServerpodRole? role, ServerpodLoggingMode? loggingMode, bool? applyMigrations, bool? applyRepairMigration, int? maxRequestSize, ServerConfig? insightsServer, ServerConfig? webServer, DatabaseConfig? database, RedisConfig? redis, String? serviceSecret, SessionLogConfig? sessionLogs, Duration? experimentalDiagnosticHandlerTimeout, FutureCallConfig? futureCall, bool? futureCallExecutionEnabled}) → 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) → bool - Checks if a configuration file is available on disk for the given run mode.