Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tika: add enableOcr option #275

Merged
merged 3 commits into from
Jul 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 27 additions & 13 deletions nix/services/tika.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ in
type = types.port;
};

enableOcr = lib.mkOption {
default = true;
description = ''
Whether to enable OCR support by adding the `tesseract` package as a dependency.
'';
type = types.bool;
};

configFile = lib.mkOption {
type = types.nullOr types.path;
default = null;
Expand All @@ -33,21 +41,27 @@ in
outputs = {
settings = {
processes = {
"${name}" = {
command = "${lib.getExe config.package} --host ${config.host} --port ${toString config.port} ${lib.optionalString (config.configFile != null) "--config ${config.configFile}"}";
availability.restart = "on_failure";
readiness_probe = {
http_get = {
host = config.host;
port = config.port;
"${name}" =
let
tikaPackage = config.package.override {
inherit (config) enableOcr;
};
in
{
command = "${lib.getExe tikaPackage} --host ${config.host} --port ${toString config.port} ${lib.optionalString (config.configFile != null) "--config ${config.configFile}"}";
availability.restart = "on_failure";
readiness_probe = {
http_get = {
host = config.host;
port = config.port;
};
initial_delay_seconds = 2;
period_seconds = 10;
timeout_seconds = 4;
success_threshold = 1;
failure_threshold = 5;
};
initial_delay_seconds = 2;
period_seconds = 10;
timeout_seconds = 4;
success_threshold = 1;
failure_threshold = 5;
};
};
};
};
};
Expand Down