{"result":{"depiction_url":null,"edges":{"references":{"objects":[{"created":"2020-05-30T05:47:32Z","object_id":{"id":1454,"is_a":["text","documentation","reference"],"name":"doc_developerguide_configuration_zotonic_configuration","title":"Global configuration","uri":"https:\/\/zotonic.com\/id\/1454"},"seq":1000000},{"created":"2020-05-30T05:47:32Z","object_id":{"id":1482,"is_a":["text","documentation","reference"],"name":"doc_developerguide_configuration_port_ssl_configuration","title":"Port configurations","uri":"https:\/\/zotonic.com\/id\/1482"},"seq":1000000},{"created":"2020-05-30T05:47:32Z","object_id":{"id":1288,"is_a":["text","documentation","reference","module"],"name":"doc_module_mod_menu","title":"mod_menu","uri":"https:\/\/zotonic.com\/id\/1288"},"seq":1000000},{"created":"2020-05-30T05:47:32Z","object_id":{"id":1353,"is_a":["text","documentation","developerguide"],"name":"doc_developerguide_modules","title":{"_type":"trans","tr":{"en":"Create a reusable module"}},"uri":"https:\/\/zotonic.com\/id\/1353"},"seq":1000000},{"created":"2020-05-30T05:47:32Z","object_id":{"id":1528,"is_a":["text","documentation","developerguide"],"name":"doc_developerguide_status_site","title":{"_type":"trans","tr":{"en":"Find the status site and your site&#39;s admin"}},"uri":"https:\/\/zotonic.com\/id\/1528"},"seq":1000000},{"created":"2020-05-30T05:47:32Z","object_id":{"id":1552,"is_a":["text","documentation","developerguide"],"name":"doc_developerguide_email","title":{"_type":"trans","tr":{"en":"Configure outbound email and verify delivery"}},"uri":"https:\/\/zotonic.com\/id\/1552"},"seq":1000000},{"created":"2020-05-30T05:47:32Z","object_id":{"id":1729,"is_a":["text","documentation","reference","model"],"name":"doc_model_model_config","title":"config","uri":"https:\/\/zotonic.com\/id\/1729"},"seq":1000000}],"predicate":{"id":332,"is_a":["meta","predicate"],"name":"references","title":{"_type":"trans","tr":{"en":"References"}},"uri":"https:\/\/zotonic.com\/id\/references"}},"relation":{"objects":[{"created":"2020-05-30T05:47:32Z","object_id":{"id":1528,"is_a":["text","documentation","developerguide"],"name":"doc_developerguide_status_site","title":{"_type":"trans","tr":{"en":"Find the status site and your site&#39;s admin"}},"uri":"https:\/\/zotonic.com\/id\/1528"},"seq":1000000}],"predicate":{"id":303,"is_a":["meta","predicate"],"name":"relation","title":{"_type":"trans","tr":{"nl":"Relatie","en":"Relation"}},"uri":"http:\/\/purl.org\/dc\/terms\/relation"}}},"id":1728,"is_a":["text","documentation","reference"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1728"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_developerguide_configuration_site_configuration","page_url":{"en":"https:\/\/zotonic.com\/docs\/1728\/site-configuration","x-default":"https:\/\/zotonic.com\/docs\/1728\/site-configuration"},"preview_url":null,"resource":{"body":"<div>\n            \n  <div class=\"section\">\n\n<p>This chapter describes the configuration options for your sites. There’s also\n<a class=\"reference internal\" href=\"\/id\/doc_developerguide_configuration_zotonic_configuration#guide-configuration\"><span class=\"std std-ref\">global configuration<\/span><\/a>.<\/p>\n<div class=\"section\">\n<h2>Site config locations<\/h2>\n<p>Configuration for sites is stored:<\/p>\n<ul class=\"simple\">\n<li>in a <code class=\"docutils literal notranslate\"><span class=\"pre\">priv\/zotonic_site.config<\/span><\/code> file in the site directory<\/li>\n<li>optionally, in files in the site’s <code class=\"docutils literal notranslate\"><span class=\"pre\">priv\/config.d\/<\/span><\/code> directory. This is so that\nautomated provisioning tools can easily override site configuration.<\/li>\n<\/ul>\n<p>The <code class=\"docutils literal notranslate\"><span class=\"pre\">config.d<\/span><\/code> files will extend and\/or override the configuration options\nfrom the <code class=\"docutils literal notranslate\"><span class=\"pre\">zotonic_site.config<\/span><\/code> file. So if the same key is present in both\n<code class=\"docutils literal notranslate\"><span class=\"pre\">zotonic_site.config<\/span><\/code> and <code class=\"docutils literal notranslate\"><span class=\"pre\">config.d\/some-file<\/span><\/code>, the value from <code class=\"docutils literal notranslate\"><span class=\"pre\">some-file<\/span><\/code>\nwill be used. The files under <code class=\"docutils literal notranslate\"><span class=\"pre\">config.d\/<\/span><\/code> are read in alphabetical order.<\/p>\n<\/div>\n<div class=\"section\">\n<h2>Parameters<\/h2>\n<aside class=\"admonition important\">\n<p class=\"first admonition-title\">Important<\/p>\n<p class=\"last\">After changing any of these configuration parameters,\n<a class=\"reference internal\" href=\"\/id\/doc_developerguide_status_site#restart-site\"><span class=\"std std-ref\">restart the site<\/span><\/a> for the change to take effect.<\/p>\n<\/aside>\n<div class=\"section\">\n<h3>admin_password<\/h3>\n<p>The password for the admin user:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"p\">{<\/span><span class=\"n\">admin_password<\/span><span class=\"p\">,<\/span> <span class=\"s\">&quot;top_secret&quot;<\/span><span class=\"p\">},<\/span>\n<\/pre><\/div>\n<\/div>\n<p>Note that if the <em>admin_password<\/em> is set to <code class=\"docutils literal notranslate\"><span class=\"pre\">admin<\/span><\/code> then only clients with\nlocal network addresses can logon as the admin. See also <code class=\"docutils literal notranslate\"><span class=\"pre\">ip_allowlist<\/span><\/code> below.<\/p>\n<\/div>\n<div class=\"section\">\n<a name=\"ref-site-configuration-database\"><\/a><h3>dbhost<\/h3>\n<p>Database host that the site connects to. Example:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"p\">{<\/span><span class=\"n\">dbhost<\/span><span class=\"p\">,<\/span> <span class=\"s\">&quot;127.0.0.1&quot;<\/span><span class=\"p\">},<\/span>\n<\/pre><\/div>\n<\/div>\n<p>Defaults to the <code class=\"docutils literal notranslate\"><span class=\"pre\">dbhost<\/span><\/code> in the Zotonic config.\nWhich defaults to <code class=\"docutils literal notranslate\"><span class=\"pre\">127.0.0.1<\/span><\/code>.<\/p>\n<\/div>\n<div class=\"section\">\n<h3>dbport<\/h3>\n<p>Port of the database server. Example:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"p\">{<\/span><span class=\"n\">dbport<\/span><span class=\"p\">,<\/span> <span class=\"mi\">5432<\/span><span class=\"p\">},<\/span>\n<\/pre><\/div>\n<\/div>\n<p>Defaults to the <code class=\"docutils literal notranslate\"><span class=\"pre\">dbport<\/span><\/code> in the Zotonic config.\nWhich defaults to <code class=\"docutils literal notranslate\"><span class=\"pre\">5432<\/span><\/code>.<\/p>\n<\/div>\n<div class=\"section\">\n<h3>dbuser<\/h3>\n<p>Database user. Defaults to the <code class=\"docutils literal notranslate\"><span class=\"pre\">dbuser<\/span><\/code> in the Zotonic config.\nWhich defaults to <code class=\"docutils literal notranslate\"><span class=\"pre\">zotonic<\/span><\/code>.<\/p>\n<\/div>\n<div class=\"section\">\n<h3>dbpassword<\/h3>\n<p>Database password. Defaults to the <code class=\"docutils literal notranslate\"><span class=\"pre\">dbpassword<\/span><\/code> in the Zotonic config.\nWhich defaults to <code class=\"docutils literal notranslate\"><span class=\"pre\">zotonic<\/span><\/code>.<\/p>\n<\/div>\n<div class=\"section\">\n<h3>dbdatabase<\/h3>\n<p>Database name. Use <code class=\"docutils literal notranslate\"><span class=\"pre\">none<\/span><\/code> to run Zotonic without a database:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"p\">{<\/span><span class=\"n\">dbdatabase<\/span><span class=\"p\">,<\/span> <span class=\"n\">none<\/span><span class=\"p\">},<\/span>\n<\/pre><\/div>\n<\/div>\n<p>Defaults to the database configured in the Zotonic config (which defaults to <code class=\"docutils literal notranslate\"><span class=\"pre\">zotonic<\/span><\/code>).<\/p>\n<p>If the <code class=\"docutils literal notranslate\"><span class=\"pre\">dbuser<\/span><\/code> does not have permission to create the database then you have to create it\nyourself:<\/p>\n<div class=\"highlight-sql notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"k\">CREATE<\/span> <span class=\"k\">DATABASE<\/span> <span class=\"ss\">&quot;some_database&quot;<\/span> <span class=\"k\">ENCODING<\/span> <span class=\"o\">=<\/span> <span class=\"s1\">&#39;UTF8&#39;<\/span> <span class=\"k\">TEMPLATE<\/span> <span class=\"n\">template0<\/span><span class=\"p\">;<\/span>\n<span class=\"k\">GRANT<\/span> <span class=\"k\">ALL<\/span> <span class=\"k\">ON<\/span> <span class=\"k\">DATABASE<\/span> <span class=\"n\">some_database<\/span> <span class=\"k\">TO<\/span> <span class=\"n\">some_db_user<\/span><span class=\"p\">;<\/span>\n<\/pre><\/div>\n<\/div>\n<p>Where <em>some_db_user<\/em> must be the user you configured with <code class=\"docutils literal notranslate\"><span class=\"pre\">dbuser<\/span><\/code> and <em>some_database<\/em> must be\nthe database configured with <code class=\"docutils literal notranslate\"><span class=\"pre\">dbdatabase<\/span><\/code>.<\/p>\n<\/div>\n<div class=\"section\">\n<h3>dbschema<\/h3>\n<p>PostgreSQL Database schema. Defaults to either:<\/p>\n\n<p><ul class=\"simple\">\n<li>the name of the site if the <code class=\"docutils literal notranslate\"><span class=\"pre\">dbdatabase<\/span><\/code> is the default database from the zotonic config<\/li>\n<li><code class=\"docutils literal notranslate\"><span class=\"pre\">public<\/span><\/code> if the <code class=\"docutils literal notranslate\"><span class=\"pre\">dbdatabase<\/span><\/code> is set to something else than the default from the Zotonic config.<\/li>\n<\/ul>\n<\/p>\n<p>So if you configure a special database for your site then the default schema will be <code class=\"docutils literal notranslate\"><span class=\"pre\">public<\/span><\/code>.<\/p>\n<p>Example:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"p\">{<\/span><span class=\"n\">dbschema<\/span><span class=\"p\">,<\/span> <span class=\"s\">&quot;mysiteschema&quot;<\/span><span class=\"p\">},<\/span>\n<\/pre><\/div>\n<\/div>\n<p>In Zotonic, a single PostgreSQL database can host the data of multiple sites.\nThis does not work using table prefixing, but instead, Zotonic uses PostgreSQL’s\nnative feature of database schemas.<\/p>\n<p>A database schema is basically another database inside your database. If your dbuser does not\nhave permission to create the schema, then you will need to create any schema other than <code class=\"docutils literal notranslate\"><span class=\"pre\">public<\/span><\/code> first:<\/p>\n<div class=\"highlight-sql notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"k\">CREATE<\/span> <span class=\"k\">SCHEMA<\/span> <span class=\"n\">some_site<\/span><span class=\"p\">;<\/span>\n<span class=\"k\">GRANT<\/span> <span class=\"k\">ALL<\/span> <span class=\"k\">ON<\/span> <span class=\"k\">SCHEMA<\/span> <span class=\"n\">some_site<\/span> <span class=\"k\">TO<\/span> <span class=\"n\">some_db_user<\/span><span class=\"p\">;<\/span>\n<\/pre><\/div>\n<\/div>\n<p>Where <em>some_db_user<\/em> must be the user you configured with <code class=\"docutils literal notranslate\"><span class=\"pre\">dbuser<\/span><\/code>. After creating the schema, either\nrestart the site or restart Zotonic.<\/p>\n<\/div>\n<div class=\"section\">\n<h3>db_max_connections<\/h3>\n<p>Maximum number of database connections used by the site. Unused connections are\nclosed after some time.<\/p>\n<p>This parameter should be enlarged if the following error occures frequently:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"nv\">Database<\/span> <span class=\"n\">pool<\/span> <span class=\"n\">usage<\/span> <span class=\"n\">is<\/span> <span class=\"n\">close<\/span> <span class=\"n\">to<\/span> <span class=\"n\">exhaustion<\/span><span class=\"p\">,<\/span> <span class=\"n\">please<\/span> <span class=\"n\">increase<\/span> <span class=\"n\">the<\/span> <span class=\"n\">pool<\/span> <span class=\"nb\">size<\/span><span class=\"p\">.<\/span>\n<\/pre><\/div>\n<\/div>\n<p>And definitely increase the pool size if this error occurs frequently:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"nv\">Database<\/span> <span class=\"n\">pool<\/span> <span class=\"n\">is<\/span> <span class=\"n\">exhausted<\/span><span class=\"p\">,<\/span> <span class=\"n\">please<\/span> <span class=\"n\">increase<\/span> <span class=\"n\">the<\/span> <span class=\"n\">pool<\/span> <span class=\"nb\">size<\/span><span class=\"p\">.<\/span>\n<\/pre><\/div>\n<\/div>\n<p>The default is 20 connections:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"p\">{<\/span><span class=\"n\">db_max_connections<\/span><span class=\"p\">,<\/span> <span class=\"mi\">20<\/span><span class=\"p\">},<\/span>\n<\/pre><\/div>\n<\/div>\n<\/div>\n<div class=\"section\">\n<h3>depcache_memory_max<\/h3>\n<p>The maximum amount of memory a site may take (in MB). The depcache caches\nvarious results of function calls and database queries in memory. Example:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"p\">{<\/span><span class=\"n\">depcache_memory_max<\/span><span class=\"p\">,<\/span> <span class=\"mi\">100<\/span><span class=\"p\">},<\/span>\n<\/pre><\/div>\n<\/div>\n<\/div>\n<div class=\"section\">\n<h3>hostname<\/h3>\n<p>The hostname and port part of the site URL. This is used to determine to which\nsite an incoming request should be routed. Example:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"p\">{<\/span><span class=\"n\">hostname<\/span><span class=\"p\">,<\/span> <span class=\"s\">&quot;127.0.0.1&quot;<\/span><span class=\"p\">},<\/span>\n<\/pre><\/div>\n<\/div>\n<p>Note that the hostname does <em>not<\/em> specify on which port Zotonic will listen;\nthis is <a class=\"reference internal\" href=\"\/id\/doc_developerguide_configuration_port_ssl_configuration#ref-port-ssl-configuration\"><span class=\"std std-ref\">configured globally<\/span><\/a>.<\/p>\n<\/div>\n<div class=\"section\">\n<h3>hostalias<\/h3>\n<p>A list of alias hostnames for the site. By default, Zotonic redirects these\nto <code class=\"docutils literal notranslate\"><span class=\"pre\">hostname<\/span><\/code> (see <code class=\"docutils literal notranslate\"><span class=\"pre\">redirect<\/span><\/code>). Example:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"p\">{<\/span><span class=\"n\">hostalias<\/span><span class=\"p\">,<\/span> <span class=\"p\">[<\/span>\n    <span class=\"s\">&quot;example.com&quot;<\/span><span class=\"p\">,<\/span>\n    <span class=\"s\">&quot;www.example.com&quot;<\/span><span class=\"p\">,<\/span>\n    <span class=\"s\">&quot;example.net&quot;<\/span><span class=\"p\">,<\/span>\n    <span class=\"s\">&quot;www.example.net&quot;<\/span>\n<span class=\"p\">]},<\/span>\n<\/pre><\/div>\n<\/div>\n<\/div>\n<div class=\"section\">\n<a name=\"site-configuration-protocol\"><\/a><h3>redirect<\/h3>\n<p>Whether or not to redirect the host-aliases (listed by the <code class=\"docutils literal notranslate\"><span class=\"pre\">hostalias<\/span><\/code>\ndirectives) to the main hostname. Defaults to <code class=\"docutils literal notranslate\"><span class=\"pre\">true<\/span><\/code>, to prevent\ncontent duplication: it is good web practice to let your content live on a\nsingle URL only:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"p\">{<\/span><span class=\"n\">redirect<\/span><span class=\"p\">,<\/span> <span class=\"n\">true<\/span><span class=\"p\">},<\/span>\n<\/pre><\/div>\n<\/div>\n<\/div>\n<div class=\"section\">\n<h3>skeleton<\/h3>\n<p>Set by the <code class=\"docutils literal notranslate\"><span class=\"pre\">zotonic<\/span> <span class=\"pre\">addsite<\/span><\/code> command, this settings tells Zotonic\nwhich skeleton site to use. Example:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"p\">{<\/span><span class=\"n\">skeleton<\/span><span class=\"p\">,<\/span> <span class=\"n\">blog<\/span><span class=\"p\">},<\/span>\n<\/pre><\/div>\n<\/div>\n<\/div>\n<div class=\"section\">\n<h3>install_menu<\/h3>\n<p>Creates the initial main menu when installing <a class=\"reference internal\" href=\"\/id\/doc_module_mod_menu\"><span class=\"std std-ref\">mod_menu<\/span><\/a>. A menu item\nis an Erlang tuple with a resource name and list of child menu items (if any):\n<code class=\"docutils literal notranslate\"><span class=\"pre\">{name,<\/span> <span class=\"pre\">[]}<\/span><\/code>.\nExample:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"p\">{<\/span><span class=\"n\">install_menu<\/span><span class=\"p\">,<\/span> <span class=\"p\">[<\/span>\n    <span class=\"p\">{<\/span><span class=\"n\">page_some_thing<\/span><span class=\"p\">,<\/span> <span class=\"p\">[]},<\/span>\n    <span class=\"p\">{<\/span><span class=\"n\">page_some_other_thing<\/span><span class=\"p\">,<\/span> <span class=\"p\">[]},<\/span>\n    <span class=\"p\">{<\/span><span class=\"n\">page_one_more_thing<\/span><span class=\"p\">,<\/span> <span class=\"p\">[]}<\/span>\n<span class=\"p\">]},<\/span>\n<\/pre><\/div>\n<\/div>\n<\/div>\n<div class=\"section\">\n<a name=\"site-configuration-modules\"><\/a><h3>modules<\/h3>\n<p>List of all modules that are <a class=\"reference internal\" href=\"\/id\/doc_developerguide_modules#activating-modules\"><span class=\"std std-ref\">activated<\/span><\/a> when the\nsite is started. After adding a module here, <a class=\"reference internal\" href=\"\/id\/doc_developerguide_status_site#restart-site\"><span class=\"std std-ref\">restart the site<\/span><\/a>\nto load the module. Example:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"p\">{<\/span><span class=\"n\">modules<\/span><span class=\"p\">,<\/span> <span class=\"p\">[<\/span>\n    <span class=\"n\">mod_admin<\/span><span class=\"p\">,<\/span>\n    <span class=\"n\">mod_menu<\/span><span class=\"p\">,<\/span>\n    <span class=\"n\">mod_your_custom_module<\/span>\n<span class=\"p\">]},<\/span>\n<\/pre><\/div>\n<\/div>\n<\/div>\n<div class=\"section\">\n<h3>ip_allowlist<\/h3>\n<p>List of TCP\/IP addresses and their netmasks. The default admin user password\n(“admin”) will only be accepted for an IP in the allowlist. This protects\ndevelopment systems that are exposed to the internet. This can also be\nconfigured <a class=\"reference internal\" href=\"\/id\/doc_developerguide_configuration_zotonic_configuration#guide-configuration\"><span class=\"std std-ref\">globally<\/span><\/a>. Default:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"p\">{<\/span><span class=\"n\">ip_allowlist<\/span><span class=\"p\">,<\/span> <span class=\"s\">&quot;127.0.0.0\/8,10.0.0.0\/8,192.168.0.0\/16,172.16.0.0\/12,::1,fd00::\/8&quot;<\/span><span class=\"p\">}<\/span>\n<\/pre><\/div>\n<\/div>\n<\/div>\n<div class=\"section\">\n<h3>smtphost<\/h3>\n<p>Hostname you want e-mail messages to appear from. See <a class=\"reference internal\" href=\"\/id\/doc_developerguide_email#guide-email\"><span class=\"std std-ref\">E-mail handling<\/span><\/a>.<\/p>\n<\/div>\n<div class=\"section\">\n<h3>cookie_domain<\/h3>\n<p>The domain the Zotonic session-id and page-id cookies will be set on. Defaults\nto the main hostname.<\/p>\n<\/div>\n<div class=\"section\">\n<h3>installer<\/h3>\n<p>Override the default zotonic installer (<code class=\"docutils literal notranslate\"><span class=\"pre\">z_installer<\/span><\/code>). <code class=\"docutils literal notranslate\"><span class=\"pre\">&lt;module&gt;<\/span><\/code> should\nmake sure that the database, if used, is setup properly along with any\nrequired data. Note that it is <code class=\"docutils literal notranslate\"><span class=\"pre\">z_installer<\/span><\/code> that is processing the\n<code class=\"docutils literal notranslate\"><span class=\"pre\">install_modules<\/span><\/code> and <code class=\"docutils literal notranslate\"><span class=\"pre\">install_menu<\/span><\/code> options, so if this module is not used\nthen those menus and modules will not be installed unless the new module\nperforms those operations. Example:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"p\">{<\/span><span class=\"n\">installer<\/span><span class=\"p\">,<\/span> <span class=\"n\">your_installer_erlang_module<\/span><span class=\"p\">},<\/span>\n<\/pre><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"section\">\n<h2>Setting module-specific config values in the site config<\/h2>\n<p>It is also possible to add <a class=\"reference internal\" href=\"\/id\/doc_model_model_config\"><span class=\"std std-ref\">m_config<\/span><\/a> values for modules to\nthe site’s <code class=\"docutils literal notranslate\"><span class=\"pre\">sitename\/priv\/zotonic_site.config<\/span><\/code> file. To do this, add\nclauses like this to the site’s config:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"p\">{<\/span><span class=\"n\">mod_foo<\/span><span class=\"p\">,<\/span> <span class=\"p\">[{<\/span><span class=\"n\">key<\/span><span class=\"p\">,<\/span> <span class=\"n\">value<\/span><span class=\"p\">},<\/span> <span class=\"p\">...]}<\/span>\n<\/pre><\/div>\n<\/div>\n<\/div>\n<div class=\"section\">\n<h2>Using environment variables in the site config<\/h2>\n<p>Any variable in your site’s <code class=\"docutils literal notranslate\"><span class=\"pre\">zotonic_site.config<\/span><\/code> file can be retrieved from the\nOS environment variables. To do so, wrap the config value in a <code class=\"docutils literal notranslate\"><span class=\"pre\">{env,<\/span>\n<span class=\"pre\">...}<\/span><\/code> tuple. For instance, to use the <code class=\"docutils literal notranslate\"><span class=\"pre\">DB_HOST<\/span><\/code> environment\nvariable as the database host, put the following as the <code class=\"docutils literal notranslate\"><span class=\"pre\">dbhost<\/span><\/code>\nconfig value:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"p\">{<\/span><span class=\"n\">dbhost<\/span><span class=\"p\">,<\/span> <span class=\"p\">{<\/span><span class=\"n\">env<\/span><span class=\"p\">,<\/span> <span class=\"s\">&quot;DB_HOST&quot;<\/span><span class=\"p\">}},<\/span>\n<\/pre><\/div>\n<\/div>\n<p>Besides <code class=\"docutils literal notranslate\"><span class=\"pre\">{env,<\/span> <span class=\"pre\">&quot;NAME&quot;}<\/span><\/code> tuple, you can also specify <code class=\"docutils literal notranslate\"><span class=\"pre\">{env,<\/span> <span class=\"pre\">&quot;NAME&quot;,<\/span>\n<span class=\"pre\">&quot;default<\/span> <span class=\"pre\">value&quot;}<\/span><\/code> for the case the environment variable is not set:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"p\">{<\/span><span class=\"n\">dbhost<\/span><span class=\"p\">,<\/span> <span class=\"p\">{<\/span><span class=\"n\">env<\/span><span class=\"p\">,<\/span> <span class=\"s\">&quot;DB_HOST&quot;<\/span><span class=\"p\">,<\/span> <span class=\"s\">&quot;localhost&quot;<\/span><span class=\"p\">}},<\/span>\n<\/pre><\/div>\n<\/div>\n<p>To convert environment variables to integer (e.g. for the database\nport), use <code class=\"docutils literal notranslate\"><span class=\"pre\">env_int<\/span><\/code>:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"p\">{<\/span><span class=\"n\">dbhost<\/span><span class=\"p\">,<\/span> <span class=\"p\">{<\/span><span class=\"n\">env_int<\/span><span class=\"p\">,<\/span> <span class=\"s\">&quot;DB_PORT&quot;<\/span><span class=\"p\">}},<\/span>\n<\/pre><\/div>\n<\/div>\n<p>or, with default value:<\/p>\n<div class=\"highlight-erlang notranslate\"><div class=\"highlight\"><pre><span><\/span><span class=\"p\">{<\/span><span class=\"n\">dbhost<\/span><span class=\"p\">,<\/span> <span class=\"p\">{<\/span><span class=\"n\">env_int<\/span><span class=\"p\">,<\/span> <span class=\"s\">&quot;DB_PORT&quot;<\/span><span class=\"p\">,<\/span> <span class=\"s\">&quot;5432&quot;<\/span><span class=\"p\">}},<\/span>\n<\/pre><\/div>\n<\/div>\n<p>Note that the default value needs to be a string in this case, not an int.<\/p>\n<\/div>\n<\/div>\n\n\n           <\/div>","category_id":{"id":319,"is_a":["meta","category"],"name":"reference","title":"Reference","uri":"https:\/\/zotonic.com\/id\/reference"},"content_group_id":{"id":339,"is_a":["meta","content_group"],"name":"default_content_group","title":{"_type":"trans","tr":{"en":"Default Content Group"}},"uri":"https:\/\/zotonic.com\/id\/default_content_group"},"created":"2020-05-30T05:47:32Z","creator_id":{"id":336,"is_a":["person","robot"],"name":"gitbot","title":"Git","uri":"https:\/\/zotonic.com\/id\/336"},"github_url":"https:\/\/github.com\/zotonic\/zotonic\/tree\/master\/doc\/ref\/configuration\/site-configuration.rst","is_authoritative":true,"is_dependent":false,"is_featured":false,"is_protected":false,"is_published":true,"is_unfindable":false,"language":["en"],"modified":"2023-06-24T08:17:56Z","modifier_id":{"id":336,"is_a":["person","robot"],"name":"gitbot","title":"Git","uri":"https:\/\/zotonic.com\/id\/336"},"name":"doc_developerguide_configuration_site_configuration","pivot_geocode":null,"pivot_location_lat":null,"pivot_location_lng":null,"privacy":0,"publication_end":"9999-06-01T00:00:00Z","publication_start":"2023-06-24T08:17:56Z","slug":"site-configuration","title":"Site configuration","title_slug":"site-configuration","tz":"UTC","uri":null,"version":3940,"visible_for":0},"uri":"https:\/\/zotonic.com\/id\/1728","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/1728"}},"status":"ok"}