Add option to pretty print JSON config (#2292)

Moo
Maxime Besson 5 years ago
parent 26de10fd91
commit 971f132b03
  1. 13
      lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/Backends/File.pm

@ -87,7 +87,18 @@ sub store {
return UNKNOWN_ERROR;
}
binmode(FILE);
my $f = to_json( $fields, { allow_nonref => 1 } );
my $json_options = {
allow_nonref => 1,
(
$self->{prettyPrint}
? (
pretty => 1,
canonical => 1
)
: ()
)
};
my $f = to_json( $fields, $json_options );
print FILE $f;
close FILE;
umask($mask);

Loading…
Cancel
Save