forked from mirrors/nixpkgs
nixos/ripple-data-api: add import mode option
This commit is contained in:
parent
4e51a466bd
commit
5984c04f1f
|
@ -43,6 +43,24 @@ in {
|
||||||
type = types.int;
|
type = types.int;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
importMode = mkOption {
|
||||||
|
description = "Ripple data api import mode.";
|
||||||
|
default = "liveOnly";
|
||||||
|
type = types.enum ["live" "liveOnly"];
|
||||||
|
};
|
||||||
|
|
||||||
|
minLedger = mkOption {
|
||||||
|
description = "Ripple data api minimal ledger to fetch.";
|
||||||
|
default = null;
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
};
|
||||||
|
|
||||||
|
maxLedger = mkOption {
|
||||||
|
description = "Ripple data api maximal ledger to fetch.";
|
||||||
|
default = null;
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
};
|
||||||
|
|
||||||
redis = {
|
redis = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
description = "Whether to enable caching of ripple data to redis.";
|
description = "Whether to enable caching of ripple data to redis.";
|
||||||
|
@ -129,6 +147,7 @@ in {
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${pkgs.ripple-data-api}/bin/api";
|
ExecStart = "${pkgs.ripple-data-api}/bin/api";
|
||||||
|
Restart = "always";
|
||||||
User = "ripple-data-api";
|
User = "ripple-data-api";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -145,8 +164,15 @@ in {
|
||||||
LOG_FILE = "/dev/null";
|
LOG_FILE = "/dev/null";
|
||||||
};
|
};
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = let
|
||||||
ExecStart = "${pkgs.ripple-data-api}/bin/importer live debug2";
|
importMode =
|
||||||
|
if cfg.minLedger != null && cfg.maxLedger != null then
|
||||||
|
"${toString cfg.minLedger} ${toString cfg.maxLedger}"
|
||||||
|
else
|
||||||
|
cfg.importMode;
|
||||||
|
in {
|
||||||
|
ExecStart = "${pkgs.ripple-data-api}/bin/importer ${importMode} debug";
|
||||||
|
Restart = "always";
|
||||||
User = "ripple-data-api";
|
User = "ripple-data-api";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue