Index: stml2.scm ================================================================== --- stml2.scm +++ stml2.scm @@ -1524,11 +1524,11 @@ ;; The global session (define s:session (make-sdat)) ;; SPLIT INTO STRAIGHT FORWARD INIT AND COMPLEX INIT -(define (session:initialize self) +(define (session:initialize self #!optional (configf #f)) (sdat-set-dbtype! self 'pg) (sdat-set-page! self "home") ;; these are defaults (sdat-set-curr-page! self "home") (sdat-set-content-type! self "Content-type: text/html; charset=iso-8859-1\n\n") (sdat-set-page-type! self 'html) @@ -1554,11 +1554,11 @@ (sdat-set-sessionvars-before! self (make-hash-table)) (sdat-set-globalvars-before! self (make-hash-table)) (sdat-set-domain! self "locahost") ;; end of defaults (sdat-set-script! self #f) (sdat-set-force-ssl! self #f) - (let* ((rawconfigdat (session:read-config self)) + (let* ((rawconfigdat (session:read-config self configf)) (configdat (if rawconfigdat (eval rawconfigdat) '())) (sroot (s:find-param 'sroot configdat)) (logfile (s:find-param 'logfile configdat)) (dbtype (s:find-param 'dbtype configdat)) (dbinit (s:find-param 'dbinit configdat)) @@ -1972,13 +1972,13 @@ (else (err:log "Shouldn't get here"))))) all-keys))) ;; process all keys (list "*sessionvars*" "*globalvars*" page-name)))))) ;; (pg:sql-null-object? element) -(define (session:read-config self) +(define (session:read-config self #!optional (fname #f)) (let* ((cgi-path (pathname-directory (car (argv)))) - (name (string-append (if cgi-path (conc cgi-path "/") "") "." (pathname-file (car (argv))) ".config"))) + (name (or fname (string-append (if cgi-path (conc cgi-path "/") "") "." (pathname-file (car (argv))) ".config")))) (if (not (file-exists? name)) (print name " not found at " (current-directory)) (let* ((fp (open-input-file name)) (initargs (read fp))) (close-input-port fp)