From df45cf258a02de93735b6149f8474280eba84508 Mon Sep 17 00:00:00 2001 From: ibizaman Date: Tue, 25 Oct 2022 22:02:51 -0700 Subject: [PATCH] use with clause to avoid repetitions --- haproxy/config.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/haproxy/config.nix b/haproxy/config.nix index 118ee4d..79a2497 100644 --- a/haproxy/config.nix +++ b/haproxy/config.nix @@ -18,11 +18,13 @@ , prometheusStatsUri ? null }: +with builtins; +with lib.strings; let stats = if statsEnable then "" else '' frontend stats - bind localhost:${builtins.toString statsPort} + bind localhost:${toString statsPort} mode http stats enable # stats hide-version @@ -33,12 +35,12 @@ let ''); indent = spaces: content: - lib.strings.concatMapStrings + concatMapStrings (x: spaces + x + "\n") - (lib.strings.splitString "\n" content); + (splitString "\n" content); - frontends_str = lib.strings.concatMapStrings (acl: indent " " acl) frontends; - backends_str = builtins.concatStringsSep "\n" backends; + frontends_str = concatMapStrings (acl: indent " " acl) frontends; + backends_str = concatStringsSep "\n" backends; in