Browse Source

Convert YAML booleans

master
Daniel Berteaud 1 month 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 {
56 56
   }
57 57
 }
58 58
 
59
+sub yaml_convert_bool {
60
+  my $val = shift;
61
+  if ( $val =~ m/^y|Y|yes|Yes|YES|true|True|TRUE$/ ){
62
+    return 1;
63
+  } else {
64
+    return 0;
65
+  }
66
+}
67
+
59 68
 #### End Routines ####
60 69
 
61 70
 GetOptions (
@@ -90,6 +99,11 @@ foreach ( keys %{ $cmd } ){
90 99
   $conf->{$_} = $cmd->{$_} if ( $cmd->{$_} );
91 100
 }
92 101
 
102
+# YAML::Tiny doesn't handle boolean
103
+foreach my $key ( qw(compress keep_alive) ) {
104
+  $conf->{$key} = yaml_convert_bool($conf->{$key});
105
+}
106
+
93 107
 # Now check config makes sens
94 108
 if (
95 109
      not $conf->{url} or

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

@@ -8,7 +8,10 @@
8 8
 
9 9
 # If enabled, data will be compressed before being sent. Default is enabled
10 10
 # Might be disabled for debuging purpose
11
-# compress: True
11
+# compress: yes
12
+
13
+# If enabled, will use keep-alive with the HTTP server. Default is enabled
14
+# keep_alive: yes
12 15
 
13 16
 # If you http endpoint is protected with basic auth, set username and password
14 17
 # username: foo

Loading…
Cancel
Save