z_config_files (zotonic_core v1.0.0-rc.10)
Link to this section Summary
Functions
Find the default directory for cache files. Checks the following locations
Find the directory with the configuration files. Defaults to the OS specific directory for all configurations. This checks a list of possible locations
Find the default directory for data files. Checks the following locations
Find the default directory for log files. Checks the following locations
Find the default directory for certificates and other secrets. Checks the following locations
Link to this section Functions
cache_dir()
-spec cache_dir() -> {ok, file:filename_all()} | {error, term()}.
Find the default directory for cache files. Checks the following locations:
- The environment variable ZOTONIC_CACHE_DIR
- Local working directory caches
- The OS specific directory for application cache files
If no directory is found then the OS specific directory is used:
- Linux: $HOME/.cache/zotonic/
- macOS: $HOME/Library/Caches/zotonic/
config_dir()
-spec config_dir() -> {ok, file:filename_all()} | {error, term()}.
Find the directory with the configuration files. Defaults to the OS specific directory for all configurations. This checks a list of possible locations:
- The init argument zotonic_config_dir
- The environment variable ZOTONIC_CONFIG_DIR
- The directory $HOME/.zotonic
- The directory /etc/zotonic (only on Unix)
- The OS specific directory for application config files
In the last three cases subdirectories are also checked, in the following order:
- The complete Erlang node name
- The short node name without the server address
- The complete Zotonic version (eg. 1.2.3)
- The minor Zotonic version (eg. 1.2)
- The major Zotonic version (eg. 1)
- The directory itself, without any version
If no directory is found then the OS specific directory with the the major Zotonic version is used. Examples:
- Linux: $HOME/.config/zotonic/config/1/
- macOS: $HOME/Library/Application Support/zotonic/config/1/
config_dir(Node)
-spec config_dir(node()) -> {ok, file:filename_all()} | {error, term()}.
consult(File)
-spec consult(file:filename_all()) -> {ok, [map() | proplists:proplist()]} | {error, term()}.
data_dir()
-spec data_dir() -> {ok, file:filename_all()} | {error, term()}.
Find the default directory for data files. Checks the following locations:
- The environment variable ZOTONIC_DATA_DIR
- Local working directory data
- The OS specific directory for application data files
If no directory is found then the OS specific directory is used:
- Linux: $HOME/.local/share/zotonic/
- macOS: $HOME/Library/Application Support/zotonic/
files(Dir)
-spec files(file:filename_all()) -> [file:filename_all()].
files(Dir, Wildcard)
-spec files(file:filename_all(), string()) -> [file:filename_all()].
log_dir()
-spec log_dir() -> {ok, file:filename_all()} | {error, term()}.
Find the default directory for log files. Checks the following locations:
- The environment variable ZOTONIC_LOG_DIR
- Local working directory logs
- The OS specific directory for application log files
If no directory is found then the OS specific directory is used:
- Linux: $HOME/.cache/zotonic/log/
- macOS: $HOME/Library/Logs/zotonic//
security_dir()
-spec security_dir() -> {ok, file:filename_all()} | {error, term()}.
Find the default directory for certificates and other secrets. Checks the following locations:
- The environment variable ZOTONIC_SECURITY_DIR
- The directory $HOME/.zotonic/security
- The directory /etc/zotonic/security (only on Unix)
- The OS specific directory for application config files
If no directory is found then the OS specific directory with the the subdirectory security is used:
- Linux: $HOME/.config/zotonic/security/
- macOS: $HOME/Library/Application Support/zotonic/security/