APIServerConfig class

API Server Config.

Implementers

Constructors

APIServerConfig({bool? development, String? name, String? version, String? address, int? port, int? securePort, Object? documentRoot, Object? domains, Object? letsEncryptDirectory, bool letsEncrypt = false, bool? letsEncryptProduction, bool? allowRequestLetsEncryptCertificate, bool hotReload = false, int? totalWorkers = 1, bool? cookieless, bool? useSessionID, String? apiCacheControl, String? staticFilesCacheControl, String? longLivedStaticFilesCacheControl, Object? longLivedStaticFilesCached, APICrossOriginConfig? crossOrigin, bool? cacheStaticFilesResponses, int? staticFilesCacheMaxMemorySize, int? staticFilesCacheMaxContentLength, int? maxPayloadLength, bool? decompressPayload, APIConfig? apiConfig, bool? logToConsole, bool? logQueue, Duration? serverResponseDelay, Object? args})
APIServerConfig.fromArgs(List<String> args)
factory
APIServerConfig.fromJson(Map<String, dynamic> json)
factory

Properties

address → String
The bind address of this server.
final
allowRequestLetsEncryptCertificate → bool
If true allows the request of Let's Encrypt certificates.
final
apiCacheControl → String
The cache-control header for API responses.
final
apiConfig → APIConfig?
The APIConfig of the APIRoot.
final
args → ArgsSimple
All the parsed arguments, using ArgsSimple.
final
cacheStaticFilesResponses → bool
If true will cache static files. Default: true
final
cookieless → bool
If true will remove any Set-Cookie or Cookie header.
final
crossOrigin → APICrossOriginConfig
The cross-origin configuration: the CORS headers of API responses and the cross-origin isolation headers of static file responses.
final
decompressPayload → bool
Whether to decompress the request payload if it is compressed using a supported Content-Encoding (e.g., gzip or deflate).
final
development → bool
final
domains → List<String>
Returns a list of domains at domainsRoots keys (non RegExp entries).
no setter
domainsRoots → Map<Pattern, Directory>
The domains root directories.
final
hashCode → int
The hash code for this object.
no setterinherited
hotReload → bool
If true enables Hot Reload (APIHotReload.enable).
final
letsEncrypt → bool
If true enabled Let's Encrypt.
final
letsEncryptDirectory → Directory?
The Let's Encrypt certificates Directory.
final
letsEncryptProduction → bool
If true runs Let's Encrypt in production mode.
final
logQueue ↔ bool
If false disables log flush queue.
latefinal
logToConsole ↔ bool
If true log messages to stdout (console).
latefinal
longLivedStaticFilesCacheControl → String
The cache-control for long-lived static files. See longLivedStaticFilesCached.
final
longLivedStaticFilesCached → List<Pattern>
Patterns of files using longLivedStaticFilesCacheControl. See staticFilesCacheControl.
final
maxPayloadLength → int?
The maximum allowed request payload size in bytes.
final
name → String
The name of this server.
final
port → int
The listen port of this server (HTTP).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
securePort → int
The listen secure port of this server (HTTPS).
final
serverResponseDelay → Duration?
A forced delay in each server response. Only active if development is true.
final
staticFilesCacheControl → String
The cache-control header for static files.
final
staticFilesCacheMaxContentLength → int
The maximum Content-Length (in bytes) allowed for a cached Response. Default: 10M
final
staticFilesCacheMaxMemorySize → int
The maximum memory size (in bytes) for storing all cached Responses. Default: 50M
final
totalWorkers → int
The number of APIServerWorker instances to spawn.
final
useSessionID → bool
If true the server will use/generate a SESSIONID for each request. If false will ignore any SESSIONID cookie (useful to comply with cookieless servers).
final
version → String
The version of this server.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

normalizeAddress(String? address, {APIConfig? apiConfig}) → String
normalizeHeaderValue(String? header, String def, [APIConfig? apiConfig, String? k0, String? k1, String? k2, String? k3]) → String
parseDomainDirectory(Object? dirPath, {bool checkDirectoryExistence = false}) → Directory?
Parses a domain Directory.
parseDomainEntry(Object? o, {bool checkDirectoryExistence = false}) → MapEntry<Pattern, Directory?>?
Parses a domain entry as MapEntry.
parseDomainPattern(Pattern domainPatter) → Pattern
Parses a domain pattern.
parseDomains(Object? o, {APIConfig? apiConfig, Object? documentRoot, bool checkDirectoryExistence = false}) → Map<Pattern, Directory>
Parses a set of domains to serve static files.
resolveAllowRequestLetsEncryptCertificate(bool? allowRequestLetsEncryptCertificate, {APIConfig? apiConfig}) → bool
resolveArgs(Object? args) → ArgsSimple
resolveCacheStaticFilesResponses(bool? cache, {APIConfig? apiConfig}) → bool
resolveCookieless(bool? cookieless, {APIConfig? apiConfig}) → bool
resolveDecompressPayload(bool? decompressPayload, {APIConfig? apiConfig}) → bool
resolveDomainsRoots(List domains, [Directory? rootDir]) → Map<String, Directory>
resolveLetsEncryptDirectory(Object? directory, {APIConfig? apiConfig, bool letsEncrypt = false}) → Directory?
resolveLetsEncryptProduction(bool? letsEncryptProduction, {APIConfig? apiConfig}) → bool
resolveLogQueue(bool? logQueue, {APIConfig? apiConfig}) → bool
resolveLogToConsole(bool? logToConsole, {APIConfig? apiConfig}) → bool
resolveLongLivedStaticFiles(Object? patterns, {List<Pattern>? def, APIConfig? apiConfig}) → List<Pattern>
resolveMaxPayloadLength(int? maxPayloadLength, {APIConfig? apiConfig}) → int?
resolvePort(int? port, {APIConfig? apiConfig}) → int
resolveSecurePort(int? securePort, {APIConfig? apiConfig, bool? letsEncrypt}) → int
resolveStaticFilesCacheMaxContentLength(int? max, {APIConfig? apiConfig}) → int
resolveStaticFilesCacheMaxMemorySize(int? max, {APIConfig? apiConfig}) → int
resolveTotalWorkers(int? totalWorkers, {APIConfig? apiConfig}) → int
resolveUseSessionID(bool? cookieless, bool? useSessionID, {APIConfig? apiConfig}) → bool

Constants

defaultApiCacheControl → const String
The default value for apiCacheControl.
defaultLongLivedStaticFilesCacheControl → const String
The default value for longLivedStaticFilesCacheControl:
defaultLongLivedStaticFilesCached → const List<Pattern>
Default list of patterns for files that should use defaultLongLivedStaticFilesCacheControl.
defaultStaticFilesCacheControl → const String
The default value for staticFilesCacheControl: