conf_d.pl -- Load configuration directories
This module deals with loading configuration-files from a directory. This is pretty simple because we assume that configuration files are Prolog source-files. We (can) use file_search_path/2 to define one or more configuration directories.
Files are loaded in alphabetical order. If one config file requires another, there are two solutions:
- Use some numbering scheme, e.g., name the files 00-
prefixes.pl
, 01-paths.pl
, etc. - Use a use_module/1 call to include the config
file(s)
on which we depend.
- load_conf_d(+Spec, +Options) is det
- Locate configuration directories and load their config files.
Config files themselves are Prolog source files. Options:
- solutions(+Sols)
- Passed to absolute_file_name/3. Default is
all
, loading config files from all directories described by Spec. - extension(+Ext)
- File-name extension for the config files. Default is
pl
.
Other options are passed to load_files/2.
- conf_d_enabled(-Dir) is nondet
- True if Dir is a directory from which config files are loaded.
- conf_d_reload is det
- Reload configuration files after adding or deleting config files. Note that this is not exactly the same as restarting the server. First of all, the order in which the files are loaded may be different and second, wiping a config file only wipes the clauses and module. Side effects, for example due to executed directives, are not reverted.
- conf_d_members(+Dir, -InfoRecords:list, Options) is det
- Provide information about config files in Dir.
- conf_d_member_data(?Field, +ConfigInfo, ?Value) is nondet
- True if Value is the value for Field in ConfigInfo. ConfigInfo
is an opaque term as returned by conf_d_info/3. Defined fields
are:
- file
- Absolute path of the file
- module
- Module defined in the file (can fail)
- title
- Comment-title (from /** <module> Title .. */)
- loaded
- Boolean, indicating whether the file is currently loaded.
- conf_d_configuration(+Available, +Enabled, -Configs) is det