From 83d3657979ebc5d405f4d53408a0a6de0ea075bf Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Wed, 9 Oct 2019 18:31:25 +0200 Subject: [PATCH] TT#68300 Do not consider a missing configuration file fatal We should not consider a missing configuration file a fatal problem, now that we have defaults for almost every configuration setting, and can override them at constructor time. Change-Id: I371498e9d75e81c4c759012ec38b44d050bdea8f --- lib/NGCP/API/Client.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/NGCP/API/Client.pm b/lib/NGCP/API/Client.pm index cd09c58..9c1d784 100644 --- a/lib/NGCP/API/Client.pm +++ b/lib/NGCP/API/Client.pm @@ -16,8 +16,10 @@ sub _load_config_defaults { my $cfg_file = '/etc/default/ngcp-api'; my $cfg; - $cfg = Config::Tiny->read($cfg_file) - or croak("Cannot read $cfg_file: $ERRNO"); + if (-e $cfg_file) { + $cfg = Config::Tiny->read($cfg_file) + or croak("Cannot read $cfg_file: $ERRNO"); + } Readonly my $config => { host => $cfg->{_}->{NGCP_API_IP} // '127.0.0.1',