z_sites_config (zotonic_core v1.0.0-rc.17)
Load and manage site configuration files.
Summary
Functions
Check if the Erlang application is a Zotonic site. A Zotonic site has a site configuration file in its priv directory.
Iff a site is running in backup environment, and its config files are restored from a remote system, then the environment in the config file is overwritten by the config from the remote environment. To keep the site in backup environment, we write a file "priv/BACKUP". If this file is present then it is hard-coded to set the environment to backup and the site to enabled.
Remove the priv/BACKUP file. After this the site will use the environment from the config files.
Merge the global config options into the site's options, adding defaults.
Functions
Check if the Erlang application is a Zotonic site. A Zotonic site has a site configuration file in its priv directory.
-spec config_files(atom()) -> [file:filename_all()].
-spec config_files(node(), atom()) -> [file:filename_all()].
-spec maybe_set_backup_env(Context) -> ok | {error, Reason} when Context :: z:context(), Reason :: term().
Iff a site is running in backup environment, and its config files are restored from a remote system, then the environment in the config file is overwritten by the config from the remote environment. To keep the site in backup environment, we write a file "priv/BACKUP". If this file is present then it is hard-coded to set the environment to backup and the site to enabled.
-spec maybe_unset_backup_env(Context) -> ok | {error, Reason} when Context :: z:context(), Reason :: term().
Remove the priv/BACKUP file. After this the site will use the environment from the config files.
-spec merge_global_configs(Sitename, SiteConfig, GlobalConfig) -> MergedConfig when Sitename :: atom(), SiteConfig :: map(), GlobalConfig :: map(), MergedConfig :: map().
Merge the global config options into the site's options, adding defaults.
-spec read_configs([file:filename_all()]) -> {ok, map()} | {error, term()}.
-spec security_dir(atom()) -> {ok, file:filename_all()} | {error, term()}.