summaryrefslogtreecommitdiff
path: root/src/scm/webid-oidc/hello-world.scm
diff options
context:
space:
mode:
Diffstat (limited to 'src/scm/webid-oidc/hello-world.scm')
-rw-r--r--src/scm/webid-oidc/hello-world.scm27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/scm/webid-oidc/hello-world.scm b/src/scm/webid-oidc/hello-world.scm
index 9dc85cb..8e68359 100644
--- a/src/scm/webid-oidc/hello-world.scm
+++ b/src/scm/webid-oidc/hello-world.scm
@@ -16,6 +16,7 @@
(define-module (webid-oidc hello-world)
#:use-module (webid-oidc resource-server)
+ #:use-module (webid-oidc server log)
#:use-module (webid-oidc jti)
#:use-module ((webid-oidc config) #:prefix cfg:)
#:use-module (web request)
@@ -48,14 +49,20 @@
(complete-corresponding-source-sym
(string->symbol (G_ "command-line|complete-corresponding-source")))
(help-sym
- (string->symbol (G_ "comand-line|help")))
+ (string->symbol (G_ "command-line|help")))
(port-sym
- (string->symbol (G_ "comand-line|port"))))
+ (string->symbol (G_ "command-line|port")))
+ (log-file-sym
+ (string->symbol (G_ "command-line|log-file")))
+ (error-file-sym
+ (string->symbol (G_ "command-line|error-file"))))
(let ((options
(let ((option-spec
`((,complete-corresponding-source-sym (single-char #\S) (value #t))
(,version-sym (single-char #\v) (value #f))
(,help-sym (single-char #\h) (value #f))
+ (,log-file-sym (single-char #\l) (value #t))
+ (,error-file-sym (single-char #\e) (value #t))
(,port-sym (single-char #\p) (value #t)))))
(getopt-long (command-line) option-spec))))
(cond
@@ -80,12 +87,18 @@ Options:
display the version information (~a) and exit.
-p PORT, --~a=PORT:
set the port to bind.
+ -l FILE.log, --~a=FILE.log:
+ redirect the program standard output to FILE.log.
+ -e FILE.err, --~a=FILE.err:
+ redirect the program errors to FILE.err.
")
(car (command-line))
complete-corresponding-source-sym
help-sym version-sym
cfg:version
- port-sym))
+ port-sym
+ log-file-sym
+ error-file-sym))
((option-ref options version-sym #f)
(format #t (G_ "~a version ~a\n")
cfg:package cfg:version))
@@ -99,7 +112,9 @@ Options:
(G_ "You are legally required to link to the complete corresponding source code.\n"))
(exit 1))
str))
- (jti-list (make-jti-list)))
+ (jti-list (make-jti-list))
+ (log-file (option-ref options log-file-sym #f))
+ (error-file (option-ref options error-file-sym #f)))
(unless (and (string->number port-string)
(integer? (string->number port-string))
(>= (string->number port-string) 0)
@@ -109,6 +124,10 @@ Options:
(exit 1))
(let ((handler
(lambda (request request-body)
+ (when log-file
+ (prepare-log-file log-file))
+ (when error-file
+ (prepare-error-file error-file))
(if (eq? (request-method request) 'GET)
(let ((agent (assoc-ref (request-headers request) 'xxx-agent)))
(if (and agent (string->uri agent))