ADDED datashare-testing/.spublish.config Index: datashare-testing/.spublish.config ================================================================== --- /dev/null +++ datashare-testing/.spublish.config @@ -0,0 +1,6 @@ +[settings] +target-dir #{scheme (create-directory "/tmp/#{getenv USER}/target" #t)} +allowed-users matt + +[database] +location /tmp/#{getenv USER} Index: spublish.scm ================================================================== --- spublish.scm +++ spublish.scm @@ -107,10 +107,14 @@ ;; ...)) ;; Create the sqlite db (define (spublish:db-do configdat proc) (let ((path (configf:lookup configdat "database" "location"))) + (if (not path) + (begin + (print "[database]\nlocation /some/path\n\n Is missing from the config file!") + (exit 1))) (if (and path (directory? path) (file-read-access? path)) (let* ((dbpath (conc path "/spublish.db")) (writeable (file-write-access? dbpath)) @@ -447,11 +451,21 @@ (make-hash-table)))) (define (spublish:process-action configdat action . args) (let* ((target-dir (configf:lookup configdat "settings" "target-dir")) (user (current-user-name)) - (allowed-users (configf:lookup configdat "settings" "allowed-users"))) + (allowed-users (string-split + (or (configf:lookup configdat "settings" "allowed-users") + "")))) + (if (not target-dir) + (begin + (print "[settings]\ntarget-dir /some/path\n\n Is MISSING from the config file!") + (exit))) + (if (null? allowed-users) + (begin + (print "[setings]\nallowed-users user1 user2 ...\n\n Is MISSING from the config file!") + (exit))) (if (not (member user allowed-users)) (begin (print "User \"" (current-user-name) "\" does not have access. Exiting") (exit 1))) (case (string->symbol action)