status-react/nix/lib/getEnvWithDefault.nix
Siddarth Kumar 4eff9cc39c
fix: don't show trace message when default is set (#18464)
`getEnvWithDefault.nix` prints a trace message in console when a default value is not set. 

In this commit we add a check to see if default value matches the value of that env var.
Otherwise we get log messages like these when running `make run-ios`

```
trace: getEnvWithDefault IOS_STATUS_GO_TARGETS 
(default: ios/arm64;iossimulator/amd64): ios/arm64;iossimulator/amd64
trace: getEnvWithDefault IOS_STATUS_GO_TARGETS 
(default: ios/arm64;iossimulator/amd64): ios/arm64;iossimulator/amd64
```

We also fix a tiny mistake in `make run-ios` status-go target by updating the delimiter to be a semi-colon instead of a comma.
2024-01-11 14:57:28 +05:30

9 lines
279 B
Nix

name: default: let
envOverride = builtins.getEnv name;
logEnvOverride = value:
builtins.trace "getEnvWithDefault ${name} (default: ${toString default}): ${value}" value;
in
if envOverride != "" && envOverride != default
then logEnvOverride envOverride
else default