summaryrefslogtreecommitdiff
path: root/rodion/services
diff options
context:
space:
mode:
authorRodion Goritskov <rodion.goritskov@gmail.com>2024-04-22 12:29:39 +0400
committerRodion Goritskov <rodion.goritskov@gmail.com>2024-04-22 12:29:39 +0400
commitf71bfbf250ae2730691be78b62583b9607f6b923 (patch)
tree7920ebb7895ea411d59a01c26291d39494143e0c /rodion/services
parent5ce7acb0ecbf9e0e3656161d94dfab97f7826d63 (diff)
Unneeded fields refactor in Miniflux service
Diffstat (limited to 'rodion/services')
-rw-r--r--rodion/services/miniflux.scm21
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