#!/usr/bin/perl

BEGIN { # set active db to production - default is test
    use FindBin qw($Bin); # warn 'BIN:'.$Bin;
    # set lib paths for app:
    use lib "$Bin/../lib";

    #$ENV{RDB_DOMAIN} = 'development'; # if using __PACKAGE__->default_domain( $ENV{RDB_DOMAIN}) in LIMS::DB
    $ENV{ROSEDB_DEVINIT} = "$Bin/../config/rosedb_devinit_devel.pl"; # overrides default db test
    # set REPORT_HTML flag - server operates in single-process mode so calling img in url
    # for PDF generation fails:
    $ENV{REPORT_HTML} = 1;
}

use LIMS::Dispatch;
use CGI::Application::Server;

my $server = CGI::Application::Server->new();

$server->document_root("$Bin/../static");
$server->entry_points( { '/hmds' => 'LIMS::Dispatch' } );

=begin
# use %overrides & $server->dispatch_args() if using CAD default (ie not class => My::Dispatch)
my $path_to_app = '/home/raj/www/apps/HMDS/lib';

my %overrides = (
    prefix => 'LIMS',
    default => 'search',
    debug => 1,
    args_to_new => {
           PARAMS => {
                t0 => [gettimeofday],
                cfg_file => $path_to_app . '/lib/config.pl', # or config_files => [ qw// ]
            },
    },
);

$server->dispatch_args(\%overrides);
=cut

$server->run;