| 1 | package POE::Component::Server::AsyncEndpoint::ChannelAdapter::Config; | ||
| 2 | |||
| 3 | use warnings; | ||
| 4 | use strict; | ||
| 5 | our @EXPORT = ( ); | ||
| 6 | use base qw(Exporter); | ||
| 7 | use vars qw($VERSION); | ||
| 8 | $VERSION = '0.10'; | ||
| 9 | |||
| 10 | use AppConfig ':argcount'; | ||
| 11 | use File::Find; | ||
| 12 | use Carp qw(croak); | ||
| 13 | |||
| 14 | sub init { | ||
| 15 | |||
| 16 | my $self = shift; | ||
| 17 | my $alias = shift; | ||
| 18 | |||
| 19 | my $base_dir = 'endpoints/'.$alias; | ||
| 20 | |||
| 21 | my $config = AppConfig->new( | ||
| 22 | {GLOBAL => {ARGCOUNT => ARGCOUNT_ONE}}, | ||
| 23 | 'socuser' => {DEFAULT => 'user'}, | ||
| 24 | 'socpass' => {DEFAULT => 'pass'}, | ||
| 25 | 'stcuser' => {DEFAULT => 'user'}, | ||
| 26 | 'stcpass' => {DEFAULT => 'pass'}, | ||
| 27 | 'soap_proxy' => {DEFAULT => undef}, | ||
| 28 | 'soap_service' => {DEFAULT => undef}, | ||
| 29 | 'mq_address' => {DEFAULT => '127.0.0.1'}, | ||
| 30 | 'mq_port' => {DEFAULT => 61614}, | ||
| 31 | 'ikc_addr' => {DEFAULT => undef}, | ||
| 32 | 'ikc_port' => {DEFAULT => undef}, | ||
| 33 | 'popper_freq' => {DEFAULT => 10}, | ||
| 34 | 'soc_retry' => {DEFAULT => 10}, | ||
| 35 | 'start' => {DEFAULT => 0}, | ||
| 36 | ); | ||
| 37 | |||
| 38 | my $fn = undef; | ||
| 39 | |||
| 40 | # find and load endpoint config file... | ||
| 41 | find( sub{ $fn = $File::Find::name if /^endpoint\.conf$/ }, $base_dir); | ||
| 42 | $config->file($fn) if($fn); | ||
| 43 | |||
| 44 | return $config; | ||
| 45 | |||
| 46 | } | ||
| 47 | |||
| 48 | 1; | ||
| 49 | |||
| 50 | __END__ |