checkCertificate method

Future<void> checkCertificate({
  1. ServerAdapter? server,
})

Stops the start when the files of AppConfig.tls, or of a port of AppConfig.ports, are bad: it throws a TlsException. Dox().startServer() runs it once, before any isolate starts. Else each isolate fails on its own and is started again, in a loop. It does nothing when no port has tls, and for a CustomServer.

Implementation

Future<void> checkCertificate({ServerAdapter? server}) async {
  AppConfig config = Dox().config;
  ServerAdapter? builtIn = ServerAdapters.builtIn(server);
  if (builtIn == null) return;
  ServerTls? main = ServerAdapters.tls(config.tls);
  if (main != null) builtIn.checkTls(main);
  for (PortConfig port in config.ports) {
    ServerTls? tls = ServerAdapters.tls(port.tls);
    if (tls != null) builtIn.checkTls(tls);
  }
}