Config Handling

Set framework attributes, looks for a config.pl file in project and assert facts. Otherwise, set reasonable defaults.

*/

    9:- module(sw_config_handling,
   10    [ get_config/2
   11    ]
   12).   13
   14:- ( absolute_file_name(sw_app('config.pl'), P),
   15     exists_file(P) ->
   16     consult(P) ;
   17     assertz(config(none, none))
   18   ).
 get_config(+Key:atom, -Val:atom) is nondet
User config, else default provided.
Arguments:
Key- Name of config attribute
Val- Value of config attribute
   26get_config(Key, Val) :-
   27    config(Key, Val), !.
   28get_config(Key, Val) :-
   29    default(Key, Val).
 default(+Key:atom, +Val:atom) is nondet
Arguments:
Key- Name of config attribute
Val- Value of config attribute
   35default(static_dir, static).
   36default(templates_dir, templates).
   37default(st_encoding, utf8).
   38default(st_extension, html).
   39default(st_cache, false).
   40default(st_strip, false).
   41default(st_frontend, simple).
   42default(st_undefined, error)