Index: configf.scm ================================================================== --- configf.scm +++ configf.scm @@ -117,13 +117,13 @@ ;; read a config file, returns hash table of alists ;; adds to ht if given (must be #f otherwise) ;; envion-patt is a regex spec that identifies sections that will be eval'd ;; in the environment on the fly - -(define (read-config path ht allow-system #!key (environ-patt #f)(curr-section #f)) - (debug:print 4 "INFO: read-config " path " allow-system " allow-system " environ-patt " environ-patt " curr-section: " curr-section) +;; sections: #f => get all, else list of sections to gather +(define (read-config path ht allow-system #!key (environ-patt #f)(curr-section #f)(sections #f)) + (debug:print 4 "INFO: read-config " path " allow-system " allow-system " environ-patt " environ-patt " curr-section: " curr-section " sections: " sections) (if (not (file-exists? path)) (begin (debug:print 4 "INFO: read-config - file not found " path " current path: " (current-directory)) (if (not ht)(make-hash-table) ht)) (let ((inp (open-input-file path)) @@ -133,10 +133,11 @@ (var-flag #f);; turn on for key-var-pr and cont-ln-rx, turn off elsewhere (lead #f)) (if (eof-object? inl) (begin (close-input-port inp) + (hash-table-delete! res "") ;; we are using "" as a dumping ground and must remove it before returning the ht res) (regex-case inl (configf:comment-rx _ (loop (configf:read-line inp res) curr-section-name #f #f)) (configf:blank-l-rx _ (loop (configf:read-line inp res) curr-section-name #f #f)) @@ -144,11 +145,16 @@ (conf-dir (pathname-directory path))) (if conf-dir (change-directory conf-dir)) (read-config include-file res allow-system environ-patt: environ-patt curr-section: curr-section-name) (change-directory curr-dir) (loop (configf:read-line inp res) curr-section-name #f #f))) - (configf:section-rx ( x section-name ) (loop (configf:read-line inp res) section-name #f #f)) + (configf:section-rx ( x section-name ) (loop (configf:read-line inp res) + ;; if we have the sections list then force all settings into "" and delete it later? + (if (or (not sections) + (member section-name sections)) + section-name "") ;; stick everything into "" + #f #f)) (configf:key-sys-pr ( x key cmd ) (if allow-system (let ((alist (hash-table-ref/default res curr-section-name '())) (val-proc (lambda () (let* ((cmdres (cmd-run->list cmd)) (status (cadr cmdres)) Index: runconfig.scm ================================================================== --- runconfig.scm +++ runconfig.scm @@ -16,11 +16,11 @@ (let* ((keys (rdb:get-keys db)) (keyvals (rdb:get-key-vals db run-id)) (thekey (string-intersperse (map (lambda (x)(if x x "-na-")) keyvals) "/")) ;; Why was system disallowed in the reading of the runconfigs file? ;; NOTE: Should be setting env vars based on (target|default) - (confdat (read-config fname #f #t environ-patt: environ-patt)) + (confdat (read-config fname #f #t environ-patt: environ-patt sections: '("default" thekey))) (whatfound (make-hash-table)) (sections (list "default" thekey))) (if (not *target*)(set! *target* thekey)) ;; may save a db access or two but repeats db:get-target code (debug:print 4 "Using key=\"" thekey "\"")