about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander_Kabui2024-08-05 13:23:24 +0300
committerAlexander_Kabui2024-08-05 13:23:24 +0300
commit692865ed95877071020698be88acc190f244d155 (patch)
treee4139c509f7407e5433fb884afccb5c2bc70ba05
parent3da7ded2e22fdc8df5fdd81af7f67aef303bd268 (diff)
downloadgn-guile-692865ed95877071020698be88acc190f244d155.tar.gz
Use env variable REPO_PATH.
-rw-r--r--web/view/markdown.scm6
-rwxr-xr-xweb/webserver.scm7
2 files changed, 6 insertions, 7 deletions
diff --git a/web/view/markdown.scm b/web/view/markdown.scm
index 4f085bd..1220898 100644
--- a/web/view/markdown.scm
+++ b/web/view/markdown.scm
@@ -21,17 +21,16 @@
 	    markdown-github->sxml
 	    fetch-file
 	    fetch-raw-file
-	    commit-file)
+	    commit-file
+	    is-repo?)
   )
 
 
-
 (define (markdown-file->sxml fn)
   "Parse a local file"
   (commonmark->sxml
    (call-with-input-file fn
      get-string-all)))
-
 ;; --- fetch github style URLs
 
 (define (fetch-raw-file url)
@@ -91,6 +90,7 @@
     commit-sha))
 
 (define* (commit-file repo file-path content commit-message username email #:optional (prev-commit ""))
+
   (if (string=? prev-commit (get-latest-commit-sha1 repo))
       #t
       (throw 'system-error (format #f "Commits do no match.Please pull in latest  changes for current * ~a * and prev * ~a * "
diff --git a/web/webserver.scm b/web/webserver.scm
index 8ecf3fb..bb07afd 100755
--- a/web/webserver.scm
+++ b/web/webserver.scm
@@ -176,7 +176,9 @@ otherwise search for set/group data"
     (lambda (key . args)
       (let ((msg (car args))) (build-json-response 400 `(("error" . ,key) ("msg" . ,msg))))     
       )))
-(define global-repo "/home/kabui/test_repo")  ;; todo ;; fix this 
+
+(define global-repo (getenv "REPO_PATH"))  ;; handle this better way
+
 (define (is-invalid-data? data target)
   (if (string? (assoc-ref data target))
       (if (string-null? (assoc-ref data target))
@@ -187,9 +189,6 @@ otherwise search for set/group data"
       ))
 
 (define (commit-file-handler repo request body)
-  ;; TODO add  validations for is email ;; maybe send a request to gn-auth
-  ;;call gn-auth to validate token  
-  ;;  TODO add validation for valid markdown
   (catch 'system-error
     (lambda ()
       (let* ((post-data