Commit | Line | Data |
20038dd8 |
1 | package App::Clifton::Server; |
2 | |
3 | use aliased 'App::Clifton::ServiceContainer'; |
4 | use aliased 'App::Clifton::ConfigLoader'; |
5 | use Moo; |
6 | |
7 | extends 'App::Clifton::Service'; |
8 | |
9 | sub BUILD { |
10 | my ($self, $args) = @_; |
11 | $args->{loop}->add($self); |
12 | $self->$_ for qw(services); |
13 | } |
14 | |
15 | has config_file => (is => 'ro', required => 1); |
16 | |
17 | has config_loader => (is => 'lazy'); |
18 | |
19 | sub _build_config_loader { ConfigLoader->new } |
20 | |
21 | has services => (is => 'lazy'); |
22 | |
23 | sub _build_services { |
24 | shift->_new_child(ServiceContainer, {}); |
25 | } |
26 | |
27 | sub reload_config { shift->_do(reload_config => @_) } |
28 | sub shutdown { shift->_do(shutdown => @_) } |
29 | |
30 | sub _body_for_reload_config { |
31 | my ($self, $args) = @_; |
32 | $args->{on_finished}->(); |
33 | } |
34 | |
35 | 1; |