Commit d4a614bc authored by Keith Jolley's avatar Keith Jolley

Add PSGI file to run REST interface from PSGI servers.

parent 423fcea5
#!/usr/bin/perl -T
#!/usr/bin/perl
#bigsrest.pl REST interface for BIGSdb
#Written by Keith Jolley
#Copyright (c) 2014, University of Oxford
......@@ -30,21 +30,24 @@ use constant {
HOST => 'localhost',
PORT => 5432,
USER => 'apache',
PASSWORD => ''
PASSWORD => '',
URI_BASE => 'http://rest.pubmlst.org/'
};
#######End Local configuration################################
use Log::Log4perl qw(get_logger); #Also need Log::Dispatch::File
use lib (LIB_DIR);
use BIGSdb::REST::Interface;
Log::Log4perl->init_once( CONFIG_DIR . '/rest_logging.conf' );
BIGSdb::REST::Interface->new(
my $app = BIGSdb::REST::Interface->new(
{
config_dir => CONFIG_DIR,
lib_dir => LIB_DIR,
dbase_config_dir => DBASE_CONFIG_DIR,
uri_base => URI_BASE,
host => HOST,
port => PORT,
user => USER,
password => PASSWORD
}
);
$app->dance;
#!/usr/bin/env perl
use strict;
use warnings;
BEGIN { $ENV{DANCER_APPHANDLER} = 'PSGI';}
use Dancer2;
use FindBin '$RealBin';
use Plack::Runner;
# For some reason Apache SetEnv directives dont propagate
# correctly to the dispatchers, so forcing PSGI and env here
# is safer.
set apphandler => 'PSGI';
set environment => 'production';
my $psgi = path($RealBin, 'bigsrest.pl');
die "Unable to read startup script: $psgi" unless -r $psgi;
Plack::Runner->run($psgi);
......@@ -32,6 +32,7 @@ use BIGSdb::REST::Routes::Resources;
use BIGSdb::REST::Routes::Schemes;
use BIGSdb::REST::Routes::Users;
use constant PAGE_SIZE => 100;
set behind_proxy => 1;
sub new {
my ( $class, $options ) = @_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment