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