From 146ed05a7af38e583c993ecd2383e6e9f30428f3 Mon Sep 17 00:00:00 2001 From: Vivien Kraus Date: Fri, 2 Jul 2021 14:44:56 +0200 Subject: Re-open the log file for each request The rottlog service seems to need this behavior. --- guix/vkraus/services/webid-oidc.scm | 2 + po/fr.po | 156 ++++++++++++++++++---------------- po/webid-oidc.pot | 150 ++++++++++++++++---------------- src/scm/webid-oidc/hello-world.scm | 27 +++++- src/scm/webid-oidc/program.scm | 29 ++++--- src/scm/webid-oidc/server/Makefile.am | 6 +- src/scm/webid-oidc/server/log.scm | 33 +++++++ src/webid-oidc-hello | 5 -- 8 files changed, 239 insertions(+), 169 deletions(-) create mode 100644 src/scm/webid-oidc/server/log.scm diff --git a/guix/vkraus/services/webid-oidc.scm b/guix/vkraus/services/webid-oidc.scm index 641c700..d985116 100644 --- a/guix/vkraus/services/webid-oidc.scm +++ b/guix/vkraus/services/webid-oidc.scm @@ -310,6 +310,8 @@ (string-append #$webid-oidc "/bin/webid-oidc-hello") "--complete-corresponding-source" #$ccs "--port" (with-output-to-string (lambda () (display #$port))) + "--log-file" "hello.log" + "--error-file" "hello.err" #$@extra-options) #:user "webid-oidc" #:group "webid-oidc" diff --git a/po/fr.po b/po/fr.po index d4f75d6..19d0686 100644 --- a/po/fr.po +++ b/po/fr.po @@ -2,8 +2,8 @@ msgid "" msgstr "" "Project-Id-Version: webid-oidc 0.0.0\n" "Report-Msgid-Bugs-To: vivien@planete-kraus.eu\n" -"POT-Creation-Date: 2021-07-02 11:34+0200\n" -"PO-Revision-Date: 2021-07-02 11:34+0200\n" +"POT-Creation-Date: 2021-07-02 14:51+0200\n" +"PO-Revision-Date: 2021-07-02 15:05+0200\n" "Last-Translator: Vivien Kraus \n" "Language-Team: French \n" "Language: fr\n" @@ -986,24 +986,32 @@ msgstr "~a : échec d’authentificationn : ~a\n" msgid "Warning: ~a\n" msgstr "Avertissement : ~a\n" -#: src/scm/webid-oidc/hello-world.scm:47 src/scm/webid-oidc/example-app.scm:116 -#: src/scm/webid-oidc/program.scm:118 +#: src/scm/webid-oidc/hello-world.scm:48 src/scm/webid-oidc/example-app.scm:116 +#: src/scm/webid-oidc/program.scm:123 msgid "command-line|version" msgstr "version" -#: src/scm/webid-oidc/hello-world.scm:49 src/scm/webid-oidc/program.scm:120 +#: src/scm/webid-oidc/hello-world.scm:50 src/scm/webid-oidc/program.scm:125 msgid "command-line|complete-corresponding-source" msgstr "code-source-correspondant-complet" -#: src/scm/webid-oidc/hello-world.scm:51 src/scm/webid-oidc/example-app.scm:118 -msgid "comand-line|help" +#: src/scm/webid-oidc/hello-world.scm:52 src/scm/webid-oidc/program.scm:127 +msgid "command-line|help" msgstr "aide" -#: src/scm/webid-oidc/hello-world.scm:53 -msgid "comand-line|port" +#: src/scm/webid-oidc/hello-world.scm:54 +msgid "command-line|port" msgstr "port" -#: src/scm/webid-oidc/hello-world.scm:63 +#: src/scm/webid-oidc/hello-world.scm:56 src/scm/webid-oidc/program.scm:157 +msgid "command-line|log-file" +msgstr "fichier-journal" + +#: src/scm/webid-oidc/hello-world.scm:58 src/scm/webid-oidc/program.scm:159 +msgid "command-line|error-file" +msgstr "fichier-erreur" + +#: src/scm/webid-oidc/hello-world.scm:70 #, scheme-format msgid "" "~a [OPTIONS]...\n" @@ -1026,6 +1034,10 @@ msgid "" " display the version information (~a) and exit.\n" " -p PORT, --~a=PORT:\n" " set the port to bind.\n" +" -l FILE.log, --~a=FILE.log:\n" +" redirect the program standard output to FILE.log.\n" +" -e FILE.err, --~a=FILE.err:\n" +" redirect the program errors to FILE.err.\n" msgstr "" "~a [OPTIONS]…\n" "\n" @@ -1048,21 +1060,25 @@ msgstr "" " affiche l’information de version (~a) et quitte.\n" " -p PORT, --~a=PORT :\n" " définit le port à lier.\n" +" -l FICHIER.log, --~a=FICHIER.log :\n" +" redirige la sortie standard du programme vers ce fichier.\n" +" -e FICHIER.err, --~a=FICHIER.err :\n" +" redirige la sortie d’erreur du programme vers ce fichier.\n" -#: src/scm/webid-oidc/hello-world.scm:90 src/scm/webid-oidc/example-app.scm:159 -#: src/scm/webid-oidc/program.scm:408 +#: src/scm/webid-oidc/hello-world.scm:103 +#: src/scm/webid-oidc/example-app.scm:159 src/scm/webid-oidc/program.scm:413 #, scheme-format msgid "~a version ~a\n" msgstr "~a version ~a\n" -#: src/scm/webid-oidc/hello-world.scm:99 src/scm/webid-oidc/program.scm:416 +#: src/scm/webid-oidc/hello-world.scm:112 src/scm/webid-oidc/program.scm:421 msgid "" "You are legally required to link to the complete corresponding source code.\n" msgstr "" "Vous êtes légalement tenu de fournir un lien vers le code source " "correspondant.\n" -#: src/scm/webid-oidc/hello-world.scm:108 +#: src/scm/webid-oidc/hello-world.scm:123 msgid "The port should be a number between 0 and 65535.\n" msgstr "Le port doit être un nombre entre 0 et 65535.\n" @@ -1090,6 +1106,10 @@ msgstr "Veuillez entrer un URI à requêter avec GET :" msgid "Sending a request: ~s\n" msgstr "Envoi d’une requête : ~s\n" +#: src/scm/webid-oidc/example-app.scm:118 +msgid "comand-line|help" +msgstr "aide" + #: src/scm/webid-oidc/example-app.scm:126 #, scheme-format msgid "" @@ -1213,12 +1233,12 @@ msgstr "" msgid "There was an error: ~a\n" msgstr "Il y a eu une erreur : ~a\n" -#: src/scm/webid-oidc/program.scm:72 +#: src/scm/webid-oidc/program.scm:77 #, scheme-format msgid "~a: Internal server error: ~a\n" msgstr "~a : Erreur interne du serveur : ~a\n" -#: src/scm/webid-oidc/program.scm:84 +#: src/scm/webid-oidc/program.scm:89 #, scheme-format msgid "" "The client locale ~s can’t be approximated by system locale ~s (because ~a), " @@ -1227,80 +1247,68 @@ msgstr "" "La locale du client ~s ne peut pas être approchée par la locale système ~s " "(parce que ~a), on utilise C.\n" -#: src/scm/webid-oidc/program.scm:92 +#: src/scm/webid-oidc/program.scm:97 #, scheme-format msgid "~a: ~s ~a ~s ~a\n" msgstr "~a : ~s ~a ~s ~a\n" -#: src/scm/webid-oidc/program.scm:122 -msgid "command-line|help" -msgstr "aide" - -#: src/scm/webid-oidc/program.scm:124 +#: src/scm/webid-oidc/program.scm:129 msgid "command-line|server|port" msgstr "port" -#: src/scm/webid-oidc/program.scm:126 +#: src/scm/webid-oidc/program.scm:131 msgid "command-line|server|server-name" msgstr "nom-du-serveur" -#: src/scm/webid-oidc/program.scm:128 +#: src/scm/webid-oidc/program.scm:133 msgid "command-line|server|reverse-proxy|backend-uri" msgstr "uri-arrière-plan" -#: src/scm/webid-oidc/program.scm:130 +#: src/scm/webid-oidc/program.scm:135 msgid "command-line|server|reverse-proxy|header" msgstr "en-tête" -#: src/scm/webid-oidc/program.scm:132 +#: src/scm/webid-oidc/program.scm:137 msgid "command-line|server|issuer|key-file" msgstr "fichier-clé" -#: src/scm/webid-oidc/program.scm:134 +#: src/scm/webid-oidc/program.scm:139 msgid "command-line|server|issuer|subject" msgstr "sujet" -#: src/scm/webid-oidc/program.scm:136 +#: src/scm/webid-oidc/program.scm:141 msgid "command-line|server|issuer|password" msgstr "mot-de-passe" -#: src/scm/webid-oidc/program.scm:138 +#: src/scm/webid-oidc/program.scm:143 msgid "command-line|server|issuer|jwks-uri" msgstr "uri-jwks" -#: src/scm/webid-oidc/program.scm:140 +#: src/scm/webid-oidc/program.scm:145 msgid "command-line|server|issuer|authorization-endpoint-uri" msgstr "uri-terminal-autorisation" -#: src/scm/webid-oidc/program.scm:142 +#: src/scm/webid-oidc/program.scm:147 msgid "command-line|server|issuer|token-endpoint-uri" msgstr "uri-terminal-jeton" -#: src/scm/webid-oidc/program.scm:144 +#: src/scm/webid-oidc/program.scm:149 msgid "command-line|server|client-id" msgstr "id-client" -#: src/scm/webid-oidc/program.scm:146 +#: src/scm/webid-oidc/program.scm:151 msgid "command-line|server|redirect-uri" msgstr "uri-redirection" -#: src/scm/webid-oidc/program.scm:148 +#: src/scm/webid-oidc/program.scm:153 msgid "command-line|server|client-name" msgstr "nom-client" -#: src/scm/webid-oidc/program.scm:150 +#: src/scm/webid-oidc/program.scm:155 msgid "command-line|server|client-uri" msgstr "uri-client" -#: src/scm/webid-oidc/program.scm:152 -msgid "command-line|log-file" -msgstr "fichier-journal" - -#: src/scm/webid-oidc/program.scm:154 -msgid "command-line|error-file" -msgstr "fichier-erreur" - -#: src/scm/webid-oidc/program.scm:179 +#: src/scm/webid-oidc/program.scm:184 #, scheme-format msgid "" "Usage: ~a COMMAND [OPTIONS]...\n" @@ -1612,57 +1620,57 @@ msgstr "" "Si vous trouvez une erreur dans le programme, envoyez-en un rapport à\n" "~a.\n" -#: src/scm/webid-oidc/program.scm:329 src/scm/webid-oidc/program.scm:387 -#: src/scm/webid-oidc/program.scm:498 +#: src/scm/webid-oidc/program.scm:334 src/scm/webid-oidc/program.scm:392 +#: src/scm/webid-oidc/program.scm:495 msgid "command-line|command|reverse-proxy" msgstr "proxy-inversé" -#: src/scm/webid-oidc/program.scm:330 src/scm/webid-oidc/program.scm:394 -#: src/scm/webid-oidc/program.scm:518 +#: src/scm/webid-oidc/program.scm:335 src/scm/webid-oidc/program.scm:399 +#: src/scm/webid-oidc/program.scm:517 msgid "command-line|command|identity-provider" msgstr "fournisseur-identité" -#: src/scm/webid-oidc/program.scm:331 src/scm/webid-oidc/program.scm:401 -#: src/scm/webid-oidc/program.scm:559 +#: src/scm/webid-oidc/program.scm:336 src/scm/webid-oidc/program.scm:406 +#: src/scm/webid-oidc/program.scm:561 msgid "command-line|command|client-service" msgstr "service-client" -#: src/scm/webid-oidc/program.scm:332 src/scm/webid-oidc/program.scm:585 +#: src/scm/webid-oidc/program.scm:337 src/scm/webid-oidc/program.scm:590 msgid "command-line|command|server" msgstr "serveur" -#: src/scm/webid-oidc/program.scm:368 src/scm/webid-oidc/program.scm:372 -#: src/scm/webid-oidc/program.scm:376 src/scm/webid-oidc/program.scm:380 +#: src/scm/webid-oidc/program.scm:373 src/scm/webid-oidc/program.scm:377 +#: src/scm/webid-oidc/program.scm:381 src/scm/webid-oidc/program.scm:385 #, scheme-format msgid "an environment variable| It is currently set to ~s." msgstr " Elle vaut actuellement ~s." -#: src/scm/webid-oidc/program.scm:370 src/scm/webid-oidc/program.scm:374 -#: src/scm/webid-oidc/program.scm:378 src/scm/webid-oidc/program.scm:382 +#: src/scm/webid-oidc/program.scm:375 src/scm/webid-oidc/program.scm:379 +#: src/scm/webid-oidc/program.scm:383 src/scm/webid-oidc/program.scm:387 msgid "an environment variable| It is currently unset." msgstr " Elle n’est actuellement pas définie." -#: src/scm/webid-oidc/program.scm:423 +#: src/scm/webid-oidc/program.scm:428 #, scheme-format msgid "The --~a argument must be a number, not ~s.\n" msgstr "L’argument de --~a doit être un nombre, pas ~s.\n" -#: src/scm/webid-oidc/program.scm:429 +#: src/scm/webid-oidc/program.scm:434 #, scheme-format msgid "The --~a argument must be an integer, not ~s.\n" msgstr "L’argument de --~a doit être un entier, pas ~s.\n" -#: src/scm/webid-oidc/program.scm:435 +#: src/scm/webid-oidc/program.scm:440 #, scheme-format msgid "The --~a argument must be positive, ~s is invalid.\n" msgstr "L’argument de --~a doit être positif, ~s est invalide.\n" -#: src/scm/webid-oidc/program.scm:440 +#: src/scm/webid-oidc/program.scm:445 #, scheme-format msgid "The --~a argument must be less than 65536, ~s is invalid.\n" msgstr "L’argument de --~a doit être inférieur à 65536, ~s est invalide.\n" -#: src/scm/webid-oidc/program.scm:482 +#: src/scm/webid-oidc/program.scm:487 #, scheme-format msgid "" "Usage: ~a COMMAND [OPTIONS]...\n" @@ -1671,18 +1679,18 @@ msgstr "" "Utilisation : ~a COMMANDE [OPTIONS]...\n" "Voir --~a (-h).\n" -#: src/scm/webid-oidc/program.scm:501 src/scm/webid-oidc/program.scm:521 -#: src/scm/webid-oidc/program.scm:587 +#: src/scm/webid-oidc/program.scm:498 src/scm/webid-oidc/program.scm:520 +#: src/scm/webid-oidc/program.scm:592 #, scheme-format msgid "You must pass --~a to set the server name.\n" msgstr "Vous devez passer --~a pour définir le nom du serveur.\n" -#: src/scm/webid-oidc/program.scm:505 +#: src/scm/webid-oidc/program.scm:502 #, scheme-format msgid "You must pass --~a to set the backend URI.\n" msgstr "Vous devez passer --~a pour définir l'URI du service d’arrière-plan.\n" -#: src/scm/webid-oidc/program.scm:525 src/scm/webid-oidc/program.scm:591 +#: src/scm/webid-oidc/program.scm:524 src/scm/webid-oidc/program.scm:596 #, scheme-format msgid "" "You must pass --~a to set the file where to store the identity provider " @@ -1691,58 +1699,58 @@ msgstr "" "Vous devez passer --~a pour définir le nom du fichier pour sauvegarder\n" "la clé du fournisseur d’identité.\n" -#: src/scm/webid-oidc/program.scm:529 src/scm/webid-oidc/program.scm:595 +#: src/scm/webid-oidc/program.scm:528 src/scm/webid-oidc/program.scm:600 #, scheme-format msgid "You must pass --~a to set the subject of the identity provider.\n" msgstr "" "Vous devez passer --~a pour définir le sujet du fournisseur d’identité.\n" -#: src/scm/webid-oidc/program.scm:533 src/scm/webid-oidc/program.scm:599 +#: src/scm/webid-oidc/program.scm:532 src/scm/webid-oidc/program.scm:604 #, scheme-format msgid "You must pass --~a to set the subject’s password.\n" msgstr "Vous devez passer --~a pour définir le mot de passe du sujet.\n" -#: src/scm/webid-oidc/program.scm:537 src/scm/webid-oidc/program.scm:603 +#: src/scm/webid-oidc/program.scm:536 src/scm/webid-oidc/program.scm:608 #, scheme-format msgid "You must pass --~a to set the JWKS URI.\n" msgstr "Vous devez passer --~a pour définir l'URI du JWKS.\n" -#: src/scm/webid-oidc/program.scm:541 src/scm/webid-oidc/program.scm:607 +#: src/scm/webid-oidc/program.scm:540 src/scm/webid-oidc/program.scm:612 #, scheme-format msgid "You must pass --~a to set the authorization endpoint URI.\n" msgstr "" "Vous devez passer --~a pour définir l'URI du terminal d'autorisation.\n" -#: src/scm/webid-oidc/program.scm:545 src/scm/webid-oidc/program.scm:611 +#: src/scm/webid-oidc/program.scm:544 src/scm/webid-oidc/program.scm:616 #, scheme-format msgid "You must pass --~a to set the token endpoint URI.\n" msgstr "Vous devez passer --~a pour définir l'URI du terminal de jeton.\n" -#: src/scm/webid-oidc/program.scm:562 +#: src/scm/webid-oidc/program.scm:564 #, scheme-format msgid "You must pass --~a to set the application web ID.\n" msgstr "" "Vous devez passer --~a pour définir l'identifiant web de l’application.\n" -#: src/scm/webid-oidc/program.scm:566 +#: src/scm/webid-oidc/program.scm:568 #, scheme-format msgid "You must pass --~a to set the redirection URI.\n" msgstr "Vous devez passer --~a pour définir l'URI de redirection.\n" -#: src/scm/webid-oidc/program.scm:570 +#: src/scm/webid-oidc/program.scm:572 #, scheme-format msgid "You must pass --~a to set the informative client name.\n" msgstr "" "Vous devez passer --~a pour donner un nom pour l’application à titre " "informatif.\n" -#: src/scm/webid-oidc/program.scm:574 +#: src/scm/webid-oidc/program.scm:576 #, scheme-format msgid "You must pass --~a to set the informative client URI.\n" msgstr "" "Vous devez passer --~a pour définir l'URI du client, à titre informatif.\n" -#: src/scm/webid-oidc/program.scm:656 +#: src/scm/webid-oidc/program.scm:663 #, scheme-format msgid "Unknown command ~s\n" msgstr "Commande inconnue ~s\n" diff --git a/po/webid-oidc.pot b/po/webid-oidc.pot index bff1956..3c271d3 100644 --- a/po/webid-oidc.pot +++ b/po/webid-oidc.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: webid-oidc SNAPSHOT\n" "Report-Msgid-Bugs-To: vivien@planete-kraus.eu\n" -"POT-Creation-Date: 2021-07-02 11:34+0200\n" +"POT-Creation-Date: 2021-07-02 14:51+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -944,24 +944,32 @@ msgstr "" msgid "Warning: ~a\n" msgstr "" -#: src/scm/webid-oidc/hello-world.scm:47 src/scm/webid-oidc/example-app.scm:116 -#: src/scm/webid-oidc/program.scm:118 +#: src/scm/webid-oidc/hello-world.scm:48 src/scm/webid-oidc/example-app.scm:116 +#: src/scm/webid-oidc/program.scm:123 msgid "command-line|version" msgstr "" -#: src/scm/webid-oidc/hello-world.scm:49 src/scm/webid-oidc/program.scm:120 +#: src/scm/webid-oidc/hello-world.scm:50 src/scm/webid-oidc/program.scm:125 msgid "command-line|complete-corresponding-source" msgstr "" -#: src/scm/webid-oidc/hello-world.scm:51 src/scm/webid-oidc/example-app.scm:118 -msgid "comand-line|help" +#: src/scm/webid-oidc/hello-world.scm:52 src/scm/webid-oidc/program.scm:127 +msgid "command-line|help" msgstr "" -#: src/scm/webid-oidc/hello-world.scm:53 -msgid "comand-line|port" +#: src/scm/webid-oidc/hello-world.scm:54 +msgid "command-line|port" msgstr "" -#: src/scm/webid-oidc/hello-world.scm:63 +#: src/scm/webid-oidc/hello-world.scm:56 src/scm/webid-oidc/program.scm:157 +msgid "command-line|log-file" +msgstr "" + +#: src/scm/webid-oidc/hello-world.scm:58 src/scm/webid-oidc/program.scm:159 +msgid "command-line|error-file" +msgstr "" + +#: src/scm/webid-oidc/hello-world.scm:70 #, scheme-format msgid "" "~a [OPTIONS]...\n" @@ -984,20 +992,24 @@ msgid "" " display the version information (~a) and exit.\n" " -p PORT, --~a=PORT:\n" " set the port to bind.\n" +" -l FILE.log, --~a=FILE.log:\n" +" redirect the program standard output to FILE.log.\n" +" -e FILE.err, --~a=FILE.err:\n" +" redirect the program errors to FILE.err.\n" msgstr "" -#: src/scm/webid-oidc/hello-world.scm:90 src/scm/webid-oidc/example-app.scm:159 -#: src/scm/webid-oidc/program.scm:408 +#: src/scm/webid-oidc/hello-world.scm:103 +#: src/scm/webid-oidc/example-app.scm:159 src/scm/webid-oidc/program.scm:413 #, scheme-format msgid "~a version ~a\n" msgstr "" -#: src/scm/webid-oidc/hello-world.scm:99 src/scm/webid-oidc/program.scm:416 +#: src/scm/webid-oidc/hello-world.scm:112 src/scm/webid-oidc/program.scm:421 msgid "" "You are legally required to link to the complete corresponding source code.\n" msgstr "" -#: src/scm/webid-oidc/hello-world.scm:108 +#: src/scm/webid-oidc/hello-world.scm:123 msgid "The port should be a number between 0 and 65535.\n" msgstr "" @@ -1025,6 +1037,10 @@ msgstr "" msgid "Sending a request: ~s\n" msgstr "" +#: src/scm/webid-oidc/example-app.scm:118 +msgid "comand-line|help" +msgstr "" + #: src/scm/webid-oidc/example-app.scm:126 #, scheme-format msgid "" @@ -1107,92 +1123,80 @@ msgstr "" msgid "There was an error: ~a\n" msgstr "" -#: src/scm/webid-oidc/program.scm:72 +#: src/scm/webid-oidc/program.scm:77 #, scheme-format msgid "~a: Internal server error: ~a\n" msgstr "" -#: src/scm/webid-oidc/program.scm:84 +#: src/scm/webid-oidc/program.scm:89 #, scheme-format msgid "" "The client locale ~s can’t be approximated by system locale ~s (because ~a), " "using C.\n" msgstr "" -#: src/scm/webid-oidc/program.scm:92 +#: src/scm/webid-oidc/program.scm:97 #, scheme-format msgid "~a: ~s ~a ~s ~a\n" msgstr "" -#: src/scm/webid-oidc/program.scm:122 -msgid "command-line|help" -msgstr "" - -#: src/scm/webid-oidc/program.scm:124 +#: src/scm/webid-oidc/program.scm:129 msgid "command-line|server|port" msgstr "" -#: src/scm/webid-oidc/program.scm:126 +#: src/scm/webid-oidc/program.scm:131 msgid "command-line|server|server-name" msgstr "" -#: src/scm/webid-oidc/program.scm:128 +#: src/scm/webid-oidc/program.scm:133 msgid "command-line|server|reverse-proxy|backend-uri" msgstr "" -#: src/scm/webid-oidc/program.scm:130 +#: src/scm/webid-oidc/program.scm:135 msgid "command-line|server|reverse-proxy|header" msgstr "" -#: src/scm/webid-oidc/program.scm:132 +#: src/scm/webid-oidc/program.scm:137 msgid "command-line|server|issuer|key-file" msgstr "" -#: src/scm/webid-oidc/program.scm:134 +#: src/scm/webid-oidc/program.scm:139 msgid "command-line|server|issuer|subject" msgstr "" -#: src/scm/webid-oidc/program.scm:136 +#: src/scm/webid-oidc/program.scm:141 msgid "command-line|server|issuer|password" msgstr "" -#: src/scm/webid-oidc/program.scm:138 +#: src/scm/webid-oidc/program.scm:143 msgid "command-line|server|issuer|jwks-uri" msgstr "" -#: src/scm/webid-oidc/program.scm:140 +#: src/scm/webid-oidc/program.scm:145 msgid "command-line|server|issuer|authorization-endpoint-uri" msgstr "" -#: src/scm/webid-oidc/program.scm:142 +#: src/scm/webid-oidc/program.scm:147 msgid "command-line|server|issuer|token-endpoint-uri" msgstr "" -#: src/scm/webid-oidc/program.scm:144 +#: src/scm/webid-oidc/program.scm:149 msgid "command-line|server|client-id" msgstr "" -#: src/scm/webid-oidc/program.scm:146 +#: src/scm/webid-oidc/program.scm:151 msgid "command-line|server|redirect-uri" msgstr "" -#: src/scm/webid-oidc/program.scm:148 +#: src/scm/webid-oidc/program.scm:153 msgid "command-line|server|client-name" msgstr "" -#: src/scm/webid-oidc/program.scm:150 +#: src/scm/webid-oidc/program.scm:155 msgid "command-line|server|client-uri" msgstr "" -#: src/scm/webid-oidc/program.scm:152 -msgid "command-line|log-file" -msgstr "" - -#: src/scm/webid-oidc/program.scm:154 -msgid "command-line|error-file" -msgstr "" - -#: src/scm/webid-oidc/program.scm:179 +#: src/scm/webid-oidc/program.scm:184 #, scheme-format msgid "" "Usage: ~a COMMAND [OPTIONS]...\n" @@ -1347,127 +1351,127 @@ msgid "" "If you find a bug, then please send a report to ~a.\n" msgstr "" -#: src/scm/webid-oidc/program.scm:329 src/scm/webid-oidc/program.scm:387 -#: src/scm/webid-oidc/program.scm:498 +#: src/scm/webid-oidc/program.scm:334 src/scm/webid-oidc/program.scm:392 +#: src/scm/webid-oidc/program.scm:495 msgid "command-line|command|reverse-proxy" msgstr "" -#: src/scm/webid-oidc/program.scm:330 src/scm/webid-oidc/program.scm:394 -#: src/scm/webid-oidc/program.scm:518 +#: src/scm/webid-oidc/program.scm:335 src/scm/webid-oidc/program.scm:399 +#: src/scm/webid-oidc/program.scm:517 msgid "command-line|command|identity-provider" msgstr "" -#: src/scm/webid-oidc/program.scm:331 src/scm/webid-oidc/program.scm:401 -#: src/scm/webid-oidc/program.scm:559 +#: src/scm/webid-oidc/program.scm:336 src/scm/webid-oidc/program.scm:406 +#: src/scm/webid-oidc/program.scm:561 msgid "command-line|command|client-service" msgstr "" -#: src/scm/webid-oidc/program.scm:332 src/scm/webid-oidc/program.scm:585 +#: src/scm/webid-oidc/program.scm:337 src/scm/webid-oidc/program.scm:590 msgid "command-line|command|server" msgstr "" -#: src/scm/webid-oidc/program.scm:368 src/scm/webid-oidc/program.scm:372 -#: src/scm/webid-oidc/program.scm:376 src/scm/webid-oidc/program.scm:380 +#: src/scm/webid-oidc/program.scm:373 src/scm/webid-oidc/program.scm:377 +#: src/scm/webid-oidc/program.scm:381 src/scm/webid-oidc/program.scm:385 #, scheme-format msgid "an environment variable| It is currently set to ~s." msgstr "" -#: src/scm/webid-oidc/program.scm:370 src/scm/webid-oidc/program.scm:374 -#: src/scm/webid-oidc/program.scm:378 src/scm/webid-oidc/program.scm:382 +#: src/scm/webid-oidc/program.scm:375 src/scm/webid-oidc/program.scm:379 +#: src/scm/webid-oidc/program.scm:383 src/scm/webid-oidc/program.scm:387 msgid "an environment variable| It is currently unset." msgstr "" -#: src/scm/webid-oidc/program.scm:423 +#: src/scm/webid-oidc/program.scm:428 #, scheme-format msgid "The --~a argument must be a number, not ~s.\n" msgstr "" -#: src/scm/webid-oidc/program.scm:429 +#: src/scm/webid-oidc/program.scm:434 #, scheme-format msgid "The --~a argument must be an integer, not ~s.\n" msgstr "" -#: src/scm/webid-oidc/program.scm:435 +#: src/scm/webid-oidc/program.scm:440 #, scheme-format msgid "The --~a argument must be positive, ~s is invalid.\n" msgstr "" -#: src/scm/webid-oidc/program.scm:440 +#: src/scm/webid-oidc/program.scm:445 #, scheme-format msgid "The --~a argument must be less than 65536, ~s is invalid.\n" msgstr "" -#: src/scm/webid-oidc/program.scm:482 +#: src/scm/webid-oidc/program.scm:487 #, scheme-format msgid "" "Usage: ~a COMMAND [OPTIONS]...\n" "See --~a (-h).\n" msgstr "" -#: src/scm/webid-oidc/program.scm:501 src/scm/webid-oidc/program.scm:521 -#: src/scm/webid-oidc/program.scm:587 +#: src/scm/webid-oidc/program.scm:498 src/scm/webid-oidc/program.scm:520 +#: src/scm/webid-oidc/program.scm:592 #, scheme-format msgid "You must pass --~a to set the server name.\n" msgstr "" -#: src/scm/webid-oidc/program.scm:505 +#: src/scm/webid-oidc/program.scm:502 #, scheme-format msgid "You must pass --~a to set the backend URI.\n" msgstr "" -#: src/scm/webid-oidc/program.scm:525 src/scm/webid-oidc/program.scm:591 +#: src/scm/webid-oidc/program.scm:524 src/scm/webid-oidc/program.scm:596 #, scheme-format msgid "" "You must pass --~a to set the file where to store the identity provider " "key.\n" msgstr "" -#: src/scm/webid-oidc/program.scm:529 src/scm/webid-oidc/program.scm:595 +#: src/scm/webid-oidc/program.scm:528 src/scm/webid-oidc/program.scm:600 #, scheme-format msgid "You must pass --~a to set the subject of the identity provider.\n" msgstr "" -#: src/scm/webid-oidc/program.scm:533 src/scm/webid-oidc/program.scm:599 +#: src/scm/webid-oidc/program.scm:532 src/scm/webid-oidc/program.scm:604 #, scheme-format msgid "You must pass --~a to set the subject’s password.\n" msgstr "" -#: src/scm/webid-oidc/program.scm:537 src/scm/webid-oidc/program.scm:603 +#: src/scm/webid-oidc/program.scm:536 src/scm/webid-oidc/program.scm:608 #, scheme-format msgid "You must pass --~a to set the JWKS URI.\n" msgstr "" -#: src/scm/webid-oidc/program.scm:541 src/scm/webid-oidc/program.scm:607 +#: src/scm/webid-oidc/program.scm:540 src/scm/webid-oidc/program.scm:612 #, scheme-format msgid "You must pass --~a to set the authorization endpoint URI.\n" msgstr "" -#: src/scm/webid-oidc/program.scm:545 src/scm/webid-oidc/program.scm:611 +#: src/scm/webid-oidc/program.scm:544 src/scm/webid-oidc/program.scm:616 #, scheme-format msgid "You must pass --~a to set the token endpoint URI.\n" msgstr "" -#: src/scm/webid-oidc/program.scm:562 +#: src/scm/webid-oidc/program.scm:564 #, scheme-format msgid "You must pass --~a to set the application web ID.\n" msgstr "" -#: src/scm/webid-oidc/program.scm:566 +#: src/scm/webid-oidc/program.scm:568 #, scheme-format msgid "You must pass --~a to set the redirection URI.\n" msgstr "" -#: src/scm/webid-oidc/program.scm:570 +#: src/scm/webid-oidc/program.scm:572 #, scheme-format msgid "You must pass --~a to set the informative client name.\n" msgstr "" -#: src/scm/webid-oidc/program.scm:574 +#: src/scm/webid-oidc/program.scm:576 #, scheme-format msgid "You must pass --~a to set the informative client URI.\n" msgstr "" -#: src/scm/webid-oidc/program.scm:656 +#: src/scm/webid-oidc/program.scm:663 #, scheme-format msgid "Unknown command ~s\n" msgstr "" 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)) diff --git a/src/scm/webid-oidc/program.scm b/src/scm/webid-oidc/program.scm index 4d431da..d4b98fe 100644 --- a/src/scm/webid-oidc/program.scm +++ b/src/scm/webid-oidc/program.scm @@ -16,6 +16,7 @@ (define-module (webid-oidc program) #:use-module (webid-oidc errors) + #:use-module (webid-oidc server log) #:use-module (webid-oidc reverse-proxy) #:use-module (webid-oidc identity-provider) #:use-module (webid-oidc client) @@ -62,8 +63,12 @@ (define cache-http-get (with-cache #:http-get http-get-with-log)) -(define (handler-with-log complete-corresponding-source handler) +(define (handler-with-log log-file error-file complete-corresponding-source handler) (lambda (request request-body) + (when log-file + (prepare-log-file log-file)) + (when error-file + (prepare-error-file error-file)) (call/ec (lambda (return) (with-exception-handler @@ -484,14 +489,6 @@ If you find a bug, then please send a report to ~a. help-sym) (exit 1)) (install-suspendable-ports!) - (when (option-ref options log-file-sym #f) - (set-current-output-port - (stubs:open-output-file* (option-ref options log-file-sym #f))) - (setvbuf (current-output-port) 'none)) - (when (option-ref options error-file-sym #f) - (set-current-error-port - (stubs:open-output-file* (option-ref options error-file-sym #f))) - (setvbuf (current-error-port) 'none)) (let ((command (car rest)) (non-options (cdr rest))) (cond @@ -507,6 +504,8 @@ If you find a bug, then please send a report to ~a. (exit 1)) (run-server (handler-with-log + (option-ref options log-file-sym #f) + (option-ref options error-file-sym #f) complete-corresponding-source (make-reverse-proxy #:server-uri server-name @@ -553,7 +552,10 @@ If you find a bug, then please send a report to ~a. #:current-time current-time #:http-get cache-http-get))) (run-server - (handler-with-log complete-corresponding-source handler) + (handler-with-log + (option-ref options log-file-sym #f) + (option-ref options error-file-sym #f) + complete-corresponding-source handler) 'http (list #:port port))))) ((equal? command (G_ "command-line|command|client-service")) @@ -579,7 +581,10 @@ If you find a bug, then please send a report to ~a. #:client-name client-name #:client-uri client-uri))) (run-server - (handler-with-log complete-corresponding-source handler) + (handler-with-log + (option-ref options log-file-sym #f) + (option-ref options error-file-sym #f) + complete-corresponding-source handler) 'http (list #:port port))))) ((equal? command (G_ "command-line|command|server")) @@ -641,6 +646,8 @@ If you find a bug, then please send a report to ~a. (create-root server-name subject) (run-server (handler-with-log + (option-ref options log-file-sym #f) + (option-ref options error-file-sym #f) complete-corresponding-source (lambda (request request-body) (let ((path (uri-path (request-uri request)))) diff --git a/src/scm/webid-oidc/server/Makefile.am b/src/scm/webid-oidc/server/Makefile.am index 7551ff9..365b878 100644 --- a/src/scm/webid-oidc/server/Makefile.am +++ b/src/scm/webid-oidc/server/Makefile.am @@ -19,13 +19,15 @@ dist_serverwebidoidcmod_DATA += \ %reldir%/read.scm \ %reldir%/precondition.scm \ %reldir%/update.scm \ - %reldir%/delete.scm + %reldir%/delete.scm \ + %reldir%/log.scm serverwebidoidcgo_DATA += \ %reldir%/create.go \ %reldir%/read.go \ %reldir%/precondition.go \ %reldir%/update.go \ - %reldir%/delete.go + %reldir%/delete.go \ + %reldir%/log.go include %reldir%/resource/Makefile.am diff --git a/src/scm/webid-oidc/server/log.scm b/src/scm/webid-oidc/server/log.scm new file mode 100644 index 0000000..f7dfa48 --- /dev/null +++ b/src/scm/webid-oidc/server/log.scm @@ -0,0 +1,33 @@ +;; webid-oidc, implementation of the Solid specification +;; Copyright (C) 2021 Vivien Kraus + +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU Affero General Public License as +;; published by the Free Software Foundation, either version 3 of the +;; License, or (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU Affero General Public License for more details. + +;; You should have received a copy of the GNU Affero General Public License +;; along with this program. If not, see . + +(define-module (webid-oidc server log) + #:use-module ((webid-oidc stubs) #:prefix stubs:) + #:export + ( + prepare-log-file + prepare-error-file + )) + +(define (prepare-log-file log) + (set-current-output-port + (open-file log "a")) + (setvbuf (current-output-port) 'none)) + +(define (prepare-error-file log) + (set-current-error-port + (open-file log "a")) + (setvbuf (current-error-port) 'none)) diff --git a/src/webid-oidc-hello b/src/webid-oidc-hello index ce169d4..ea9d407 100755 --- a/src/webid-oidc-hello +++ b/src/webid-oidc-hello @@ -20,9 +20,4 @@ (use-modules (webid-oidc hello-world)) -(format (current-error-port) "Logging to hello.log and hello.err.\n") - -(set-current-output-port (open-output-file "hello.log")) -(set-current-error-port (open-output-file "hello.err")) - (main) -- cgit v1.2.3