aws-sam-cli: add argument to conditionally enable telemetry

If someone really wants to opt into telemetry, they can do so by setting
`enableTelemetry` to `true` (the default is `false`), in which case the wrapper
that sets `SAM_CLI_TELEMETRY` to `0` will not be created.

Note that this actually allows a user to optionally disable telemetry from the
command line or the (poorly documented) configuration in
`~/.aws-sam/metadata.json`. The downside is telemetry will be enabled at least
on the first run, causing a unique installation ID to be saved in the
configuration file.
This commit is contained in:
Stefano Mazzucco 2020-02-11 20:38:15 +00:00
parent c6b1ce47b6
commit 2b4794f941

View file

@ -1,5 +1,6 @@
{ lib
, python
, enableTelemetry ? false
}:
let
@ -83,7 +84,7 @@ buildPythonApplication rec {
tomlkit
];
postFixup = ''
postFixup = if enableTelemetry then "echo aws-sam-cli TELEMETRY IS ENABLED" else ''
# Disable telemetry: https://github.com/awslabs/aws-sam-cli/issues/1272
wrapProgram $out/bin/sam --set SAM_CLI_TELEMETRY 0
'';