#!perl
use strict;
use warnings;
BEGIN { eval "use Event;"; }
use App::Metabase::Relayd;
$|=1; # Make STDOUT hot
App::Metabase::Relayd->run();

__END__

=head1 NAME

metabase-relayd - A relay server for Metabase

=head1 SYNOPSIS

 metabase-relayd [options]

 Options:
   --debug 	   - display interesting things;
   --help	     - Display program usage;
   --version	 - Display program version;
   --url URI	 - The URI of a Metabase server to use;
   --idfile    - The path to an ID file to use;
   --dbfile    - The path to the database file to use;
   --address   - A particular IP address to listen on;
   --port      - The TCP port to listen on;

=head1 DESCRIPTION

metabase-relayd is a L<Metabase> relay server that acts an intermediate between
L<Test::Reporter::Transport::Socket> based CPAN Tester clients and a L<Metabase>
server.

=head1 COMMAND LINE OPTIONS

Command line options override options given in the L</"CONFIGURATION FILE">

=over

=item C<--debug>

Turns on all output.

=item C<--help>

Displays program usage and exits.

=item C<--version>

Displays the program version and exits.

=item C<--idfile FILE>

Specify a L<Metabase> ID file to use.

=item C<--dbfile FILE>

Specify the file that L<DBD::SQLite> will use for the queue storage.

=item C<--url URI>

The URL of a L<Metabase> server to send reports to.

=item C<--address IP_ADDRESS>

Specify a particular IP address for the listening socket to bind to. The default is INADDR_ANY.

=item C<--port TCP_PORT>

Specify the TCP port for the listening socket to bind to. The default is 0, ie. pick a random port.

=back

=head1 CONFIGURATION FILE

A number of the above options may be specified in a configuration file, C<relayd>, that is stored in the C<.metabase>
directory. See L</"ENVIRONMENT"> for where the C<.metabase> directory is located and how to effect its location.

Command line options will override options from the configuration file.

The configuration file is parsed using L<Config::Tiny>.

A subset of the command line options can be specified in the configuration file:

=over

=item C<debug>

Set to a true value to turn on all output.

  debug=1

=item C<--idfile FILE>

Specify a L<Metabase> ID file to use.

  idfile=/home/bingos/.metabase/id.json

=item C<--dbfile FILE>

Specify the file that L<DBD::SQLite> will use for the queue storage.

  dbfile=/home/bingos/.metabase/relaydb

=item C<--url URI>

The URL of a L<Metabase> server to send reports to.

  url=https://metabase.example.url/

=item C<--address IP_ADDRESS>

Specify a particular IP address for the listening socket to bind to. The default is INADDR_ANY.

  address=192.168.0.254

=item C<--port TCP_PORT>

Specify the TCP port for the listening socket to bind to. The default is 0, ie. pick a random port.

  port=8080

=back

=head1 ENVIRONMENT

C<metabase-relayd> uses the C<.metabase> directory to locate the configuration file, C<relayd>.

This is usually located in the current user's home directory. Setting the environment variable C<PERL5_MBRELAYD_DIR> will
effect where the C<.metabase> directory is located.

=head1 KUDOS

Thanks go to Ricardo SIGNES for L<CPAN::Mini> which inspired the design of this script/module.

=head1 AUTHOR

Chris C<BinGOs> Williams <chris@bingosnet.co.uk>

=head1 LICENSE

Copyright E<copy> Chris Williams

This module may be used, modified, and distributed under the same terms as Perl itself. Please see the license that came with your Perl distribution for details.

=head1 SEE ALSO

L<http://www.cpantesters.org/> 		- CPAN Testers: Index

L<http://wiki.cpantesters.org/> 	- CPAN Testers Wiki

L<http://stats.cpantesters.org/>	- CPAN Testers Statistics

L<Metabase>

L<DBD::SQLite>

L<Config::Tiny>

L<POE::Component::Metabase::Relay::Server>

=cut
