ktor {
    deployment {
        port = 8087

        # Uncomment this to enable SSL. If this is enabled, a certificate must be provided (see
        # security section below)
        # sslPort = 8889

    }

    application {
        modules = [ com.ustadmobile.lib.rest.UmRestApplicationKt.umRestApplication ]
    }

    ustad {
        # The URL on which the system is accessed e.g. http://you.ip.address:8087/ for development
        # or https://your.domain.name/ when running in production (e.g. behind a reverse proxy
        # such as Nginx or Apache).
        #
        # This does not need to be set if using virtualhost mode (as below).
        #
        # siteUrl = "http://192.168.1.2:8087/"

        #
        # URL prefix e.g. /ustad . If the system is not at the root url, then the prefix must be
        # specified here.

        # If siteUrl is set (e.g. virtual hosting is not being used), then the urlPrefix must match
        # e.g. if the siteUrl is https://server.com/ustad/ then the urlPrefix should be "/ustad/".
        #
        # If virtual hosting is being used, then the url prefix will apply to all virtual hosts.
        #
        # Note: this is NOT compatible with jsDevServer (because the webpack development server must
        # run using the root url)
        #
        # urlPrefix = "/ustad/"

        # dbmode can be singleton or virtualhost .  If the dbmode is virtualhost, then multiple
        # instances can run using the same server.
        dbmode = singleton

        # The data directory where content files, uploads, etc are stored. This can be a relative or
        # absolute path. If relative, it is relative to the app home directory.
        datadir = data

        # Explicitly set the /.well-known directory that can host assetlinks.json etc. By default
        # this is relative (as per datadir)
        # wellKnownDir = "well-known"

        ##Enables development mode which will enables CORS and allow to clear all tables
        devmode = "false"

        # The app download link for Android users. Users will be redirected here if they select
        # to download the app
        androidDownloadHref = "https://play.google.com/store/apps/details?id=com.toughra.ustadmobile"

        # The jsDevServer option allows using the app-react javascript client via the webpack
        # development server instead of serving the app-react production javascript bundle from
        # static resources.
        #
        # This runs a reverse proxy that will forward all requests not expected to be handled by
        # KTOR to wepack development server.
        #
        # This avoids any Cross Origin (CORS) issues because the browser will receive all HTTP
        # responses from a single origin.
        #
        # The JsDevServer will be active by default when running from source, and will be set to
        # 'http://localhost:8080/' (the default webpack server url) that runs when running
        # app-react from source (e.g. ./gradlew app-react:jsRun). It can be disabled when running
        # from source by setting it to a blank string.
        #
        # It can also be set manually (e.g. to a non-default port).
        # jsDevServer = "http://localhost:8080/"

        paths {
            # These are external commands that are required. Normally they will be automatically
            # detected in the path, and there is no need to specify them manually

            # If they are not in the path or default location, then specify them below

            # MediaInfo is used to validate and extract metadata from media files
            # mediainfo = /usr/bin/mediainfo"

            # HandBrakeCLI is used to compress video
            # handbrakecli = "/usr/bin/HandBrakeCLI"

            # SoX is used to compress audio
            # sox = "/usr/bin/sox"

            # Mpg123 is used on Windows to decode mp3 files into wav files
            # mpg123 = "C:\MyFolder\mpg123\mpg123.exe"
        }
    }

    database {
        #Change to "org.postgresql.Driver" to use Postgres. Postgres is recommended for production
        #use
        driver = "org.sqlite.JDBC"

        # Database url - this is a standard JDBC url in the form of
        #  jdbc:driver://[hostname]:[port]/databasename?params
        #
        # The following variables are supported as part of the database url:
        # (hostname) - the hostname as per the http header on the request received, with any non
        #              alphanumeric characters replaced with _ . This variable is required to provide
        #              virtual hosting - e.g. different hostnames are linked to different databases,
        #              allowing one instance of the http server instance to serve multiple
        #              learning environments using one JVM. E.g. if using
        #              jdbc:postgresql:///ustad_(hostname) then a request with the hostname
        #              schoolname.district.org would use the database url
        #              jdbc:postgresql///ustad_schoolname_district_org
        #
        # (datadir) -  this will be replaced with the absolute path to the data directory. This is
        #              required when using SQLite to avoid relying on relative paths.
        #
        # Sqlite example::
        #  jdbc:sqlite:path/to/file.sqlite?parameters
        #
        # Sqlite recommended parameters:
        # journal_mode=WAL&synchronous=OFF&busy_timeout=30000&recursive_triggers=true
        # journal_mode and synchronous parameters improve performance ( https://sqlite.org/wal.html )
        # busy_timeout is the time that SQLite will wait for a commit to finish
        # recursive_triggers are required to correctly execute progress trackers for ContentJobItem
        # See: https://github.com/xerial/sqlite-jdbc/blob/master/USAGE.md
        #
        # For Postgres
        #  jdbc:postgresql:///dbName
        #
        # JDBC postgres URLs can set the host, port, database name and options. See Postgres JDBC
        # doc for syntax: https://jdbc.postgresql.org/documentation/use/#connecting-to-the-database
        #
        url = "jdbc:sqlite:(datadir)/singleton/UmAppDatabase.sqlite?journal_mode=WAL&synchronous=OFF&busy_timeout=30000&recursive_triggers=true"

        # Enter the Postgres database username and password here if using Postgres. If using SQLite,
        # these can be left blank
        user = ""
        password = ""
    }

    # The database for Quartz is stored separately. Quartz is a library used to trigger timed tasks.
    # There is always one (and only one) quartz database, even when there are multiple virtual
    # servers.
    quartz {
        # Change to org.postgresql.Driver to use Postgres. SQLite is fine for Quartz for production
        # and testing use.
        driver = "org.hsqldb.jdbc.JDBCDriver"
        url = "jdbc:hsqldb:file:(datadir)/quartz"
        user = "SA"
        password = ""
    }

    security {
        # It is strongly recommended to configure SSL here so the app can use HTTP2. See INSTALL.md
        # for instructions. This applies even when the app is used behind a reverse proxy (because
        # HTTP2 defacto requires SSL).
        # ssl {
        #     keyStore = /etc/letsencrypt/live/mydomain.com/keystore.jks
        #     keyAlias = myalias
        #     keyStorePassword = password
        #     privateKeyPassword = password
        # }
    }
}

#
# Sending email is required to allow parents to approve a registration for their child.
#
# mail {
#    user = ""
#    auth = ""
#    from = ""
#
#    # These properties are as per the Jakarta mail property options:
#    #
#    # https://jakarta.ee/specifications/mail/1.6/apidocs/index.html?com/sun/mail/smtp/package-summary.html
#    #
#    smtp {
#        auth = "true"
#        host = ""
#        port = 587
#        starttls {
#            enable = "true"
#        }
#    }
# }
