verifyCertificatesExist method

void verifyCertificatesExist()

Implementation

void verifyCertificatesExist() {
  if (secure) {
    final certificateFiles = [
      p.join(hostCertificatePath, 'ca', 'ca.crt'),
      p.join(hostCertificatePath, 'ca', 'ca.key'),
      p.join(hostCertificatePath, 'node', 'node.crt'),
      p.join(hostCertificatePath, 'node', 'node.key'),
    ];

    for (var path in certificateFiles) {
      final file = File(path);
      if (!file.existsSync()) {
        print(
          '${file.parent} exists: ${file.parent.existsSync()}',
        );
        print(
          '${file.parent.path} exists: ${file.parent.parent.existsSync()}',
        );
        print(
          '${file.parent.parent.path} exists: ${file.parent.parent.parent.existsSync()}',
        );

        throw Exception(
          'Could not locate the certificates file ${file.absolute.path} needed '
          "to run EventStoreDB node. \nPlease run 'esdbtcli certs'.",
        );
      }
    }
  }
}