variables:
  LT_PORT:
    default: 8081
  LT_ALLOW_ORIGIN:
    default: "*"
  LT_VERSION:
    default: "4.4"
  LT_TARGET: $GRAMEXDATA/languagetool/
  LT_SRC: https://languagetool.org/download/LanguageTool-${LT_VERSION}.zip
  LT_CMD: [
    'java', '-cp', 'languagetool-server.jar',
    'org.languagetool.server.HTTPServer', '--port', '{LT_PORT}'
  ]
  LT_CWD: ${LT_TARGET}/LanguageTool-${LT_VERSION}
  LT_URL: "http://localhost:{LT_PORT}/v2/check?"

url:
  languagetool-$*:
    pattern: /$YAMLURL/
    handler: FunctionHandler
    kwargs:
      function: gramex.ml.languagetool
      headers:
        Content-Type: application/json

schedule:
  languagetool-download-$*:
    function: gramex.ml.languagetool_download()
    startup: true
    thread: true
