AppConfig constructor

AppConfig({
  1. required String appKey,
  2. List<String> previousKeys = const <String>[],
  3. int serverPort = 3000,
  4. String? host,
  5. int? totalIsolate,
  6. List<DoxProvider> providers = const <DoxProvider>[],
  7. List<DtoSchema<Object>> dtos = const <DtoSchema<Object>>[],
  8. MessageResolver? validationMessages,
  9. List globalMiddleware = const <dynamic>[],
  10. List<Router> routers = const <Router>[],
  11. void container(
    1. IocContainer c
    )?,
  12. CORSConfig cors = const CORSConfig(),
  13. LoggerConfig logger = const LoggerConfig(),
  14. CacheConfig cache = const CacheConfig(defaultStore: 'file', stores: <String, Map<String, dynamic>>{'file' : <String, dynamic>{'driver' : 'file', 'path' : 'storage/cache'}, 'memory' : <String, dynamic>{'driver' : 'memory'}}),
  15. SessionConfig session = const SessionConfig(),
  16. OpenApiConfig openApi = const OpenApiConfig(),
  17. ExceptionHandler exceptionHandler = const ExceptionHandler(),
  18. ResponseHandlerInterface? responseHandler,
  19. int maxBodySize = 10 * 1024 * 1024,
  20. int maxMultipartSize = 100 * 1024 * 1024,
  21. Duration bodyTimeout = const Duration(seconds: 120),
  22. Duration idleTimeout = const Duration(seconds: 30),
  23. int? maxConnections,
  24. List<String> trustedProxies = const <String>[],
  25. bool compress = false,
  26. Duration shutdownTimeout = const Duration(seconds: 8),
  27. List<String>? webSocketAllowedOrigins,
})

Implementation

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

  /// isolates (threads) that serve http. Default: one per CPU core.
  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.idleTimeout = const Duration(seconds: 30),
  this.maxConnections,
  this.trustedProxies = const <String>[],
  this.compress = false,
  this.shutdownTimeout = const Duration(seconds: 8),
  this.webSocketAllowedOrigins,
}) : totalIsolate = totalIsolate ?? Platform.numberOfProcessors;