cleanupHook method

  1. @override
void cleanupHook({
  1. String? hostname,
  2. String? domain,
  3. String? tld,
  4. String? emailaddress,
})
override

overload this method if your provide needs to to have a manual cleanup hook called

Implementation

@override
void cleanupHook(
    {String? hostname, String? domain, String? tld, String? emailaddress}) {
  Certbot().log('*' * 80);
  Certbot().log('cert_bot_http_cleanup_hook started');

  ///
  /// Get the environment vars passed to use
  ///
  final verbose = Environment().certbotVerbose;
  Certbot().log('verbose: $verbose');

  Settings().setVerbose(enabled: verbose);
  ArgumentError.checkNotNull(Environment().certbotToken,
      'The environment variable ${Environment.certbotTokenKey} was empty');

  /// This path MUST match the path set in the nginx config files:
  /// /etc/nginx/operating/default.conf
  /// /etc/nginx/acquire/default.conf
  final path = join('/', 'opt', 'letsencrypt', 'wwwroot', '.well-known',
      Environment().certbotToken);
  if (exists(path)) {
    delete(path);
  }

  Certbot().log('cert_bot_http_cleanup_hook completed');
  Certbot().log('*' * 80);
}