Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== Outdated egg! This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for [[/eggref/5/simple-configuration|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 [[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]] == Simple-Configuration aka Sexp-Configuration [[toc:]] === Introduction This is a small library to handle configurations in a simple manner. It uses lists as the basic datastructure to hold configurations. === Examples <enscript highlight=scheme> (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) </enscript> === Authors [[/users/david-krentzlin|David Krentzlin]] === Api <procedure>(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. <procedure>(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. <macro>(config-let config ((binding path) ...) body ...)</macro> This binds '''bindings''' to their values. It's really just a convenient way to reference multiple paths.
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you multiply 9 by 5?