AppConfig constructor

AppConfig({
  1. required String appKey,
  2. List<String> previousKeys = const <String>[],
  3. int serverPort = 3000,
  4. List<int> additionalPorts = const <int>[],
  5. List<PortConfig> ports = const <PortConfig>[],
  6. String? host,
  7. int? totalIsolate,
  8. List<DoxProvider> providers = const <DoxProvider>[],
  9. List<DtoSchema<Object>> dtos = const <DtoSchema<Object>>[],
  10. MessageResolver? validationMessages,
  11. List globalMiddleware = const <dynamic>[],
  12. List<Router> routers = const <Router>[],
  13. void container(
    1. IocContainer c
    )?,
  14. CORSConfig cors = const CORSConfig(),
  15. LoggerConfig logger = const LoggerConfig(),
  16. CacheConfig cache = const CacheConfig(defaultStore: 'file', stores: <String, Map<String, dynamic>>{'file' : <String, dynamic>{'driver' : 'file', 'path' : 'storage/cache'}, 'memory' : <String, dynamic>{'driver' : 'memory'}}),
  17. SessionConfig session = const SessionConfig(),
  18. OpenApiConfig openApi = const OpenApiConfig(),
  19. ExceptionHandler exceptionHandler = const ExceptionHandler(),
  20. ResponseHandlerInterface? responseHandler,
  21. int maxBodySize = 10 * 1024 * 1024,
  22. int maxMultipartSize = 100 * 1024 * 1024,
  23. Duration bodyTimeout = const Duration(seconds: 120),
  24. int minBodyRate = 240,
  25. Duration minBodyRateGrace = const Duration(seconds: 5),
  26. Duration idleTimeout = const Duration(seconds: 30),
  27. int? maxConnections,
  28. bool http2 = false,
  29. int maxConcurrentStreams = 250,
  30. TlsOptions? tls,
  31. List<String> trustedProxies = const <String>[],
  32. bool compress = false,
  33. int compressLevel = 1,
  34. int fileThreads = 4,
  35. int tlsHandshakesPerTick = 8,
  36. Duration shutdownTimeout = const Duration(seconds: 8),
  37. List<String>? webSocketAllowedOrigins,
  38. CoreFlags flags = const CoreFlags(),
  39. int computeWorkers = defaultComputeWorkers,
  40. StrictConfig strict = const StrictConfig(),
  41. bool htmlErrors = false,
  42. ErrorPageRenderer errorPage = defaultErrorPage,
})

Implementation

AppConfig({
  required this.appKey,
  this.previousKeys = const <String>[],
  this.serverPort = 3000,
  this.additionalPorts = const <int>[],
  this.ports = const <PortConfig>[],
  this.host,

  /// isolates (threads) that serve http. Default: one per CPU the process may use.
  int? totalIsolate,
  this.providers = const <DoxProvider>[],
  this.dtos = const <DtoSchema<Object>>[],
  this.validationMessages,
  this.globalMiddleware = const <dynamic>[],
  this.routers = const <Router>[],
  this.container,
  this.cors = const CORSConfig(),
  this.logger = const LoggerConfig(),
  this.cache = const CacheConfig(
    defaultStore: 'file',
    stores: <String, Map<String, dynamic>>{
      'file': <String, dynamic>{'driver': 'file', 'path': 'storage/cache'},
      'memory': <String, dynamic>{'driver': 'memory'},
    },
  ),
  this.session = const SessionConfig(),
  this.openApi = const OpenApiConfig(),
  this.exceptionHandler = const ExceptionHandler(),
  this.responseHandler,
  this.maxBodySize = 10 * 1024 * 1024,
  this.maxMultipartSize = 100 * 1024 * 1024,
  this.bodyTimeout = const Duration(seconds: 120),
  this.minBodyRate = 240,
  this.minBodyRateGrace = const Duration(seconds: 5),
  this.idleTimeout = const Duration(seconds: 30),
  this.maxConnections,
  this.http2 = false,
  this.maxConcurrentStreams = 250,
  this.tls,
  this.trustedProxies = const <String>[],
  this.compress = false,
  this.compressLevel = 1,
  this.fileThreads = 4,
  this.tlsHandshakesPerTick = 8,
  this.shutdownTimeout = const Duration(seconds: 8),
  this.webSocketAllowedOrigins,
  this.flags = const CoreFlags(),
  this.computeWorkers = defaultComputeWorkers,
  this.strict = const StrictConfig(),
  this.htmlErrors = false,
  this.errorPage = defaultErrorPage,
}) : totalIsolate = totalIsolate ?? Processors.available;