<commit_before>{ config, pkgs, lib, ... }:

with lib;

let
  cfg = config.services.confd;

  confdConfig = ''
    backend = "${cfg.backend}"
    confdir = "${cfg.confDir}"
    interval = ${toString cfg.interval}
    nodes = [ ${concatMapStringsSep "," (s: ''"${s}"'') cfg.nodes}, ]
    prefix = "${cfg.prefix}"
    log-level = "${cfg.logLevel}"
    watch = ${if cfg.watch then "true" else "false"}
  '';

in {
  options.services.confd = {
    enable = mkEnableOption "confd service";

    backend = mkOption {
      description = "Confd config storage backend to use.";
      default = "etcd";
      type = types.enum ["etcd" "consul" "redis" "zookeeper"];
    };

    interval = mkOption {
      description = "Confd check interval.";
      default = 10;
      type = types.int;
    };

    nodes = mkOption {
      description = "Confd list of nodes to connect to.";
      default = [ "http://127.0.0.1:4001" ];
      type = types.listOf types.str;
    };

    watch = mkOption {
      description = "Confd, whether to watch etcd config for changes.";
      default = true;
      type = types.bool;
    };

    prefix = mkOption {
      description = "The string to prefix to keys.";
      default = "/";
      type = types.path;
    };

    logLevel = mkOption {
      description = "Confd log level.";
      default = "info";
      type = types.enum ["info" "debug"];
    };

    confDir = mkOption {
      description = "The path to the confd configs.";
      default = "/etc/confd";
      type = types.path;
    };

    package = mkOption {
      description = "Confd package to use.";<commit_msg>confd service: change default etcd port 4001 -> 2379<commit_after>{ config, pkgs, lib, ... }:

with lib;

let
  cfg = config.services.confd;

  confdConfig = ''
    backend = "${cfg.backend}"
    confdir = "${cfg.confDir}"
    interval = ${toString cfg.interval}
    nodes = [ ${concatMapStringsSep "," (s: ''"${s}"'') cfg.nodes}, ]
    prefix = "${cfg.prefix}"
    log-level = "${cfg.logLevel}"
    watch = ${if cfg.watch then "true" else "false"}
  '';

in {
  options.services.confd = {
    enable = mkEnableOption "confd service";

    backend = mkOption {
      description = "Confd config storage backend to use.";
      default = "etcd";
      type = types.enum ["etcd" "consul" "redis" "zookeeper"];
    };

    interval = mkOption {
      description = "Confd check interval.";
      default = 10;
      type = types.int;
    };

    nodes = mkOption {
      description = "Confd list of nodes to connect to.";
      default = [ "http://127.0.0.1:2379" ];
      type = types.listOf types.str;
    };

    watch = mkOption {
      description = "Confd, whether to watch etcd config for changes.";
      default = true;
      type = types.bool;
    };

    prefix = mkOption {
      description = "The string to prefix to keys.";
      default = "/";
      type = types.path;
    };

    logLevel = mkOption {
      description = "Confd log level.";
      default = "info";
      type = types.enum ["info" "debug"];
    };

    confDir = mkOption {
      description = "The path to the confd configs.";
      default = "/etc/confd";
      type = types.path;
    };

    package = mkOption {
      description = "Confd package to use.";
{'fraction_non_alphanumeric': 0.15069337442218797, 'fraction_numerical': 0.009861325115562404, 'mean_word_length': 2.278787878787879, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3731235', 'n_tokens_mistral': 1034, 'n_tokens_neox': 997, 'n_words': 286}