]> git.proxmox.com Git - pmg-api.git/blob - PMG/RESTEnvironment.pm
PMG/RESTEnvironment.pm: add RESTEnvironment class
[pmg-api.git] / PMG / RESTEnvironment.pm
1 package PMG::RESTEnvironment;
2
3 use strict;
4 use warnings;
5
6 use PVE::RESTEnvironment;
7
8 use PMG::ClusterConfig;
9
10 use base qw(PVE::RESTEnvironment);
11
12 # initialize environment - must be called once at program startup
13 sub init {
14 my ($class, $type, %params) = @_;
15
16 $class = ref($class) || $class;
17
18 my $self = $class->SUPER::init($type, %params);
19
20 $self->{cinfo} = {};
21
22 return $self;
23 };
24
25 # init_request - must be called before each RPC request
26 sub init_request {
27 my ($self, %params) = @_;
28
29 $self->SUPER::init_request(%params);
30
31 $self->{cinfo} = PVE::INotify::read_file("cluster.conf");
32 }
33
34 1;