install.fairie/home/.chezmoiscripts/universal/run_before_01-disconnect-warp.sh.tmpl
Brian Zalewski 7d98e021bc
Latest
2023-08-08 16:27:50 -04:00

20 lines
No EOL
844 B
Cheetah

{{- if (ne .host.distro.family "windows") -}}
#!/usr/bin/env bash
# @file Disconnect from WARP
# @brief Disconnects from CloudFlare Teams / WARP
# @description
# This script detects for the presence of the `warp-cli` and the WARP connection status. If `warp-cli` is installed
# and WARP is connected, then the service is disconnected. This feature is here to ensure programs such as `volta`
# which do not support custom CA certificates can still function properly.
{{ includeTemplate "universal/profile-before" }}
{{ includeTemplate "universal/logg-before" }}
if command -v warp-cli > /dev/null; then
if warp-cli status | grep 'Connected' > /dev/null; then
logg info 'Disconnecting from CloudFlare Teams / WARP due to Volta ignoring CA specified in NPM configuration'
warp-cli disconnect
fi
fi
{{ end -}}