Browse Source

Convert YAML booleans

master
Daniel Berteaud 4 months ago
parent
commit
e094810b83
2 changed files with 18 additions and 1 deletions
  1. 14
    0
      systemd-journal-gelf
  2. 4
    1
      systemd-journal-gelf.yml

+ 14
- 0
systemd-journal-gelf View File

@@ -56,6 +56,15 @@ sub save_cursor {
}
}

sub yaml_convert_bool {
my $val = shift;
if ( $val =~ m/^y|Y|yes|Yes|YES|true|True|TRUE$/ ){
return 1;
} else {
return 0;
}
}

#### End Routines ####

GetOptions (
@@ -90,6 +99,11 @@ foreach ( keys %{ $cmd } ){
$conf->{$_} = $cmd->{$_} if ( $cmd->{$_} );
}

# YAML::Tiny doesn't handle boolean
foreach my $key ( qw(compress keep_alive) ) {
$conf->{$key} = yaml_convert_bool($conf->{$key});
}

# Now check config makes sens
if (
not $conf->{url} or

+ 4
- 1
systemd-journal-gelf.yml View File

@@ -8,7 +8,10 @@

# If enabled, data will be compressed before being sent. Default is enabled
# Might be disabled for debuging purpose
# compress: True
# compress: yes

# If enabled, will use keep-alive with the HTTP server. Default is enabled
# keep_alive: yes

# If you http endpoint is protected with basic auth, set username and password
# username: foo

Loading…
Cancel
Save