diff options
Diffstat (limited to 'rodion/services')
-rw-r--r-- | rodion/services/miniflux.scm | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/rodion/services/miniflux.scm b/rodion/services/miniflux.scm index 9ac78cc..4d8bf9f 100644 --- a/rodion/services/miniflux.scm +++ b/rodion/services/miniflux.scm @@ -11,11 +11,11 @@ #:use-module (ice-9 string-fun) #:export (miniflux-service-type miniflux-configuration - miniflux-configuration? - miniflux-configuration-test?)) + miniflux-configuration?)) (define (initial-string? val) (string? val)) (define (initial-boolean? val) (boolean? val)) +(define (strip-initial-prefix field-name) (string-drop (symbol->string field-name) 8)) (define (serialize-string field-name val) (format #f "~a=~a\n" (string-upcase @@ -23,20 +23,15 @@ (if (symbol? field-name) (symbol->string field-name) field-name) "-" "_")) val)) +(define (serialize-boolean field-name val) + (if val (serialize-string field-name "1") (serialize-string field-name "0"))) + +;; Initial string is just a string with 'initial-' prefix (define (serialize-initial-string field-name val) - (serialize-string (string-drop (symbol->string field-name) 8) val)) + (serialize-string (strip-initial-prefix field-name) val)) (define (serialize-initial-boolean field-name val) - (serialize-boolean (string-drop (symbol->string field-name) 8) val)) - -(define (non-negative-integer? val) - (and (exact-integer? val) (not (negative? val)))) - -(define (serialize-non-negative-integer field-name val) - (serialize-string field-name (number->string val))) - -(define (serialize-boolean field-name val) - (if val (serialize-string field-name "1") "")) + (serialize-boolean (strip-initial-prefix field-name) val)) (define-configuration miniflux-configuration (listen-addr |