#!/usr/bin/env raku

use v6.*;

use IRC::Log::Colabti:ver<0.0.28>:auth<cpan:ELIZABETH>;
use Cro::HTTP::Server:ver<0.8.5>;
use App::IRC::Log:ver<0.0.1>:auth<cpan:ELIZABETH>;;

my $ail := App::IRC::Log.new:
  log-class    => IRC::Log::Colabti,
  log-dir      => "logs",
  static-dir   => "static",
  template-dir => "templates",
  rendered-dir => "rendered",
  state-dir    => 'state',
  zip-dir      => 'zipped',
;

my $application := $ail.application;

my $service := Cro::HTTP::Server.new:
  :host<localhost>,
  :port<10000>,
  :application($ail.application),
;
$service.start;

react whenever signal(SIGINT) {
    $service.stop;
    $ail.shutdown;
    exit;
}
