(type egg)
(signature "simple-configuration egg")
(timestamp 1612269487)
(sxml ((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/simple-configuration" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.") (tags "egg")) (section 2 "Simple-Configuration aka Sexp-Configuration" (toc) (section 3 "Introduction" (p "This is a small library to handle configurations in a simple manner. It uses lists as the basic datastructure to hold configurations.")) (section 3 "Examples" (highlight scheme "(use simple-configuration)\n\n(define my-config\n '((production\n    (database\n      (username \"prod\")\n      (password \"prodpwd\")\n      (host \"test.example.com\")))\n   (development\n    (database\n      (username \"dev\")\n      (password \"devpwd\")\n      (host \"dev.example.com\")))\n  (logging\n   (destination \"/var/log/application.log\")\n   (levels (error warning)))))\n\n;; now you can access the data like so\n\n(config-ref my-config '(production database username)) ;; => \"prod\"\n(config-ref my-config '(production database))          ;; => (username \"prod\")\n(config-ref my-config '(production database))   ;; => ((username \"prod\") (password \"prodpwd\") (host \"test.example.com\"))\n\n(config-let my-config ((db-user (production database username))\n                       (db-pw   (production database password))\n                       (db-host (production database host)))\n  (connect-to-database db-host db-user db-pw))\n\n;; postprocess data\n(config-ref my-config '(logging levels) post-process: (lambda (ls) (cons 'critical ls))) ;; => (critical error warning)")) (section 3 "Authors" (p (int-link "/users/david-krentzlin" "David Krentzlin"))) (section 3 "Api" (def (sig (procedure "(config-read port-or-path #!key (eval-config #f))" (id config-read))) (p "Reads the configuration from the given port or path. If " (b "eval-config") " is set to #t then the entire config is evaled inside a quasiquote. This means you can do something like this:") (pre "  ((some-key ,(+ 10 20))") (p "If you reference the key " (b "some-key") " you will get 30.")) (def (sig (procedure "(config-ref cfg path #!key (default #f) (post-process identity))" (id config-ref))) (p "Extract a value from the configuration. Note that post-process is applied to the default-value as well.")) (def (sig (syntax "(config-let config ((binding path) ...) body ...)" (id config-let))) (p "This binds " (b "bindings") " to their values.  It's really just a convenient way to reference multiple paths."))))))
