summary refs log tree commit diff
path: root/nixos/modules/services/misc
diff options
context:
space:
mode:
authorJaka Hudoklin <jakahudoklin@gmail.com>2015-04-25 14:38:05 +0200
committerJaka Hudoklin <jakahudoklin@gmail.com>2015-04-25 14:38:05 +0200
commit5984c04f1fbb07692ae3981b3a12ab32297df2e9 (patch)
tree98f33074b4d21e186951fb92ee7d08b9af6e1767 /nixos/modules/services/misc
parent4e51a466bdfa260d15fbaafe52cdccf5280f13d1 (diff)
downloadnixlib-5984c04f1fbb07692ae3981b3a12ab32297df2e9.tar
nixlib-5984c04f1fbb07692ae3981b3a12ab32297df2e9.tar.gz
nixlib-5984c04f1fbb07692ae3981b3a12ab32297df2e9.tar.bz2
nixlib-5984c04f1fbb07692ae3981b3a12ab32297df2e9.tar.lz
nixlib-5984c04f1fbb07692ae3981b3a12ab32297df2e9.tar.xz
nixlib-5984c04f1fbb07692ae3981b3a12ab32297df2e9.tar.zst
nixlib-5984c04f1fbb07692ae3981b3a12ab32297df2e9.zip
nixos/ripple-data-api: add import mode option
Diffstat (limited to 'nixos/modules/services/misc')
-rw-r--r--nixos/modules/services/misc/ripple-data-api.nix30
1 files changed, 28 insertions, 2 deletions
diff --git a/nixos/modules/services/misc/ripple-data-api.nix b/nixos/modules/services/misc/ripple-data-api.nix
index 6e5ac7ab00bd..3b281449a256 100644
--- a/nixos/modules/services/misc/ripple-data-api.nix
+++ b/nixos/modules/services/misc/ripple-data-api.nix
@@ -43,6 +43,24 @@ in {
         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 = {
         enable = mkOption {
           description = "Whether to enable caching of ripple data to redis.";
@@ -129,6 +147,7 @@ in {
 
       serviceConfig = {
         ExecStart = "${pkgs.ripple-data-api}/bin/api";
+        Restart = "always";
         User = "ripple-data-api";
       };
     };
@@ -145,8 +164,15 @@ in {
         LOG_FILE = "/dev/null";
       };
 
-      serviceConfig = {
-        ExecStart = "${pkgs.ripple-data-api}/bin/importer live debug2";
+      serviceConfig = let
+        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";
       };