git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/ripple-data-api: add import mode option
commit5984c04f1fbb07692ae3981b3a12ab32297df2e9 authorJaka Hudoklin <jakahudoklin@gmail.com> dateSat 25 Apr 2015, 14:38 (12 years ago) parent4e51a46
1 file changed+28−2
nixos/modules/services/misc/ripple-data-api.nix+28−2
nixos/modules/services/misc/ripple-data-api.nix+28−2
@@ -43,6 +43,24 @@ in {
4343 type = types.int;
4444 };
4545
46+ importMode = mkOption {
47+ description = "Ripple data api import mode.";
48+ default = "liveOnly";
49+ type = types.enum ["live" "liveOnly"];
50+ };
51+
52+ minLedger = mkOption {
53+ description = "Ripple data api minimal ledger to fetch.";
54+ default = null;
55+ type = types.nullOr types.int;
56+ };
57+
58+ maxLedger = mkOption {
59+ description = "Ripple data api maximal ledger to fetch.";
60+ default = null;
61+ type = types.nullOr types.int;
62+ };
63+
4664 redis = {
4765 enable = mkOption {
4866 description = "Whether to enable caching of ripple data to redis.";
@@ -129,6 +147,7 @@ in {
129147
130148 serviceConfig = {
131149 ExecStart = "${pkgs.ripple-data-api}/bin/api";
150+ Restart = "always";
132151 User = "ripple-data-api";
133152 };
134153 };
@@ -145,8 +164,15 @@ in {
145164 LOG_FILE = "/dev/null";
146165 };
147166
148− serviceConfig = {
149− ExecStart = "${pkgs.ripple-data-api}/bin/importer live debug2";
167+ serviceConfig = let
168+ importMode =
169+ if cfg.minLedger != null && cfg.maxLedger != null then
170+ "${toString cfg.minLedger} ${toString cfg.maxLedger}"
171+ else
172+ cfg.importMode;
173+ in {
174+ ExecStart = "${pkgs.ripple-data-api}/bin/importer ${importMode} debug";
175+ Restart = "always";
150176 User = "ripple-data-api";
151177 };
152178