%%% This is the template for your configuration file. The %%VALUES%% below are
%%% taken from the Makefile to generate the actual configuration files.
%%% This comment will disappear.
<!-- %%WARNING%% -->
<ocsigen>
  <server>
    <port>%%PORT%%</port>
    %%% Only set for running, not for testing
    %%USERGROUP%%
    <logdir>%%LOGDIR%%</logdir>
    <datadir>%%DATADIR%%</datadir>
    <charset>utf-8</charset>
    <uploaddir>/tmp</uploaddir> <!-- Customize this -->
    <usedefaulthostname/>
    %%% Only set when debugging
    %%DEBUGMODE%%
    <extension findlib-package="ocsigenserver.ext.accesscontrol"/>
    <extension findlib-package="ocsigenserver.ext.cors"/>
    <commandpipe>%%CMDPIPE%%</commandpipe>
    <extension findlib-package="ocsigenserver.ext.staticmod"/>
    <!-- we use the PostgreSQL backend for ocsipersist,
         but there is also a DBM and an SQLite backend -->
    <!--
    <extension findlib-package="ocsipersist.dbm">
      <delayloading val="false"/>
      <store dir="%%DATADIR%%"/>
      <ocsidbm name="ocsidbm"/>
    </extension>
    -->
    <!--
    <extension findlib-package="ocsipersist.sqlite">
      <database file="%%DATADIR%%/ocsidb"/>
    </extension>
    -->
    <extension findlib-package="ocsipersist.pgsql">
      <database
        host="%%DB_HOST%%"
        port="%%DB_PORT%%"
        user="%%DB_USER%%"
        password="%%DB_PASSWORD%%"
        database="ocsipersist_%%%PROJECT_NAME%%%"
      />
    </extension>
    <extension findlib-package="eliom.server">
      <!-- Ask Eliom to ignore UTM parameters and others: -->
      <ignoredgetparams regexp="utm_[a-z]*|[a-z]*clid|li_fat_id"/>
<!-- Uncomment if you are using https only and want secure cookies:
       <securecookies value="true" />
  -->
    </extension>
    %%% This will include the packages defined as SERVER_PACKAGES in your Makefile:
    %%PACKAGES%%
    <host hostfilter="*">
      <static dir="%%FILESDIR%%" />
      %%ELIOM_MODULES%%
      <eliommodule module="%%LIBDIR%%/%%PROJECT_NAME%%.cma">
        <app name="%%APPNAME%%" css="%%CSSNAME%%" />
        <avatars dir="%%FILESDIR%%/avatars" />
        <os-db
          host="%%DB_HOST%%"
          port="%%DB_PORT%%"
          user="%%DB_USER%%"
          password="%%DB_PASSWORD%%"
          database="%%DB_NAME%%"
        />
      </eliommodule>
      <eliom/>
      <if>
        <!-- Remove the condition (or change it to true) if you're serving an iOS app and having
             "Origin null is not allowed by Access-Control-Allow-Origin.",
             since with iOS WkWebView, your origin is a local HTML file on the iOS platform. -->
        <header name="origin" regexp="http://localhost:8000"/>
        <then>
          <cors max_age="86400"
            credentials="true"
            methods="POST,GET,HEAD"
            exposed_headers="x-eliom-application,x-eliom-location,x-eliom-set-process-cookies,x-eliom-set-cookie-substitutes"/>
        </then>
      </if>
    </host>
  </server>
</ocsigen>
