Working config reload
This commit is contained in:
parent
cdd87dff72
commit
63ecd7febf
17
II/Config.pm
17
II/Config.pm
@ -5,10 +5,7 @@ use Config::Tiny;
|
|||||||
sub new {
|
sub new {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
|
|
||||||
my $c = Config::Tiny->new();
|
my $self = { _file => 'config.ini', };
|
||||||
$c = Config::Tiny->read('config.ini');
|
|
||||||
|
|
||||||
my $self = { _config => $c, };
|
|
||||||
|
|
||||||
bless $self, $class;
|
bless $self, $class;
|
||||||
return $self;
|
return $self;
|
||||||
@ -17,8 +14,11 @@ sub new {
|
|||||||
# Load configuration
|
# Load configuration
|
||||||
sub load {
|
sub load {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
my $config = $self->{_config};
|
my $file = $self->{_file};
|
||||||
|
|
||||||
|
my $tiny = Config::Tiny->new();
|
||||||
|
$config = $tiny->read($file);
|
||||||
|
|
||||||
my $key = $config->{auth}->{key};
|
my $key = $config->{auth}->{key};
|
||||||
my $nick = $config->{auth}->{nick};
|
my $nick = $config->{auth}->{nick};
|
||||||
my $host = $config->{node}->{host};
|
my $host = $config->{node}->{host};
|
||||||
@ -40,7 +40,10 @@ sub load {
|
|||||||
sub reload {
|
sub reload {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
return II::Config->load();
|
my $c = II::Config->new();
|
||||||
|
my $config = $c->load();
|
||||||
|
|
||||||
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
Loading…
Reference in New Issue
Block a user