summary refs log tree commit diff
path: root/nixos/modules/services/security/oauth2_proxy.nix
diff options
context:
space:
mode:
authorFranz Pletz <fpletz@fnordicwalking.de>2017-04-11 18:08:51 +0200
committerFranz Pletz <fpletz@fnordicwalking.de>2017-04-11 18:18:53 +0200
commit3ab45f4b369c9c741b55ddedeaac4c797dc61c04 (patch)
tree3c5e330622e42066e50ab20a6c58b9251addf863 /nixos/modules/services/security/oauth2_proxy.nix
parent54fff9ec1a9e7425926eadffada0268351536926 (diff)
downloadnixpkgs-3ab45f4b369c9c741b55ddedeaac4c797dc61c04.tar
nixpkgs-3ab45f4b369c9c741b55ddedeaac4c797dc61c04.tar.gz
nixpkgs-3ab45f4b369c9c741b55ddedeaac4c797dc61c04.tar.bz2
nixpkgs-3ab45f4b369c9c741b55ddedeaac4c797dc61c04.tar.lz
nixpkgs-3ab45f4b369c9c741b55ddedeaac4c797dc61c04.tar.xz
nixpkgs-3ab45f4b369c9c741b55ddedeaac4c797dc61c04.tar.zst
nixpkgs-3ab45f4b369c9c741b55ddedeaac4c797dc61c04.zip
treewide: use boolToString function
Diffstat (limited to 'nixos/modules/services/security/oauth2_proxy.nix')
-rw-r--r--nixos/modules/services/security/oauth2_proxy.nix17
1 files changed, 7 insertions, 10 deletions
diff --git a/nixos/modules/services/security/oauth2_proxy.nix b/nixos/modules/services/security/oauth2_proxy.nix
index caa7d9d5081..e292fd9851e 100644
--- a/nixos/modules/services/security/oauth2_proxy.nix
+++ b/nixos/modules/services/security/oauth2_proxy.nix
@@ -10,9 +10,6 @@ let
   #   repeatedArgs (arg: "--arg=${arg}") args
   repeatedArgs = concatMapStringsSep " ";
 
-  # 'toString' doesn't quite do what we want for bools.
-  fromBool = x: if x then "true" else "false";
-
   # oauth2_proxy provides many options that are only relevant if you are using
   # a certain provider. This set maps from provider name to a function that
   # takes the configuration and returns a string that can be inserted into the
@@ -49,24 +46,24 @@ let
     --client-secret='${cfg.clientSecret}' \
     ${optionalString (!isNull cfg.cookie.domain) "--cookie-domain='${cfg.cookie.domain}'"} \
     --cookie-expire='${cfg.cookie.expire}' \
-    --cookie-httponly=${fromBool cfg.cookie.httpOnly} \
+    --cookie-httponly=${boolToString cfg.cookie.httpOnly} \
     --cookie-name='${cfg.cookie.name}' \
     --cookie-secret='${cfg.cookie.secret}' \
-    --cookie-secure=${fromBool cfg.cookie.secure} \
+    --cookie-secure=${boolToString cfg.cookie.secure} \
     ${optionalString (!isNull cfg.cookie.refresh) "--cookie-refresh='${cfg.cookie.refresh}'"} \
     ${optionalString (!isNull cfg.customTemplatesDir) "--custom-templates-dir='${cfg.customTemplatesDir}'"} \
     ${repeatedArgs (x: "--email-domain='${x}'") cfg.email.domains} \
     --http-address='${cfg.httpAddress}' \
-    ${optionalString (!isNull cfg.htpasswd.file) "--htpasswd-file='${cfg.htpasswd.file}' --display-htpasswd-form=${fromBool cfg.htpasswd.displayForm}"} \
+    ${optionalString (!isNull cfg.htpasswd.file) "--htpasswd-file='${cfg.htpasswd.file}' --display-htpasswd-form=${boolToString cfg.htpasswd.displayForm}"} \
     ${optionalString (!isNull cfg.loginURL) "--login-url='${cfg.loginURL}'"} \
-    --pass-access-token=${fromBool cfg.passAccessToken} \
-    --pass-basic-auth=${fromBool cfg.passBasicAuth} \
-    --pass-host-header=${fromBool cfg.passHostHeader} \
+    --pass-access-token=${boolToString cfg.passAccessToken} \
+    --pass-basic-auth=${boolToString cfg.passBasicAuth} \
+    --pass-host-header=${boolToString cfg.passHostHeader} \
     --proxy-prefix='${cfg.proxyPrefix}' \
     ${optionalString (!isNull cfg.profileURL) "--profile-url='${cfg.profileURL}'"} \
     ${optionalString (!isNull cfg.redeemURL) "--redeem-url='${cfg.redeemURL}'"} \
     ${optionalString (!isNull cfg.redirectURL) "--redirect-url='${cfg.redirectURL}'"} \
-    --request-logging=${fromBool cfg.requestLogging} \
+    --request-logging=${boolToString cfg.requestLogging} \
     ${optionalString (!isNull cfg.scope) "--scope='${cfg.scope}'"} \
     ${repeatedArgs (x: "--skip-auth-regex='${x}'") cfg.skipAuthRegexes} \
     ${optionalString (!isNull cfg.signatureKey) "--signature-key='${cfg.signatureKey}'"} \