AppConfig constructor

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

Implementation

AppConfig({
  required this.appKey,
  this.serverPort = 3000,
  this.host,

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