install.fairie/home/.chezmoiscripts/universal/run_before_01-disconnect-warp.sh.tmpl

20 lines
844 B
Cheetah
Raw Normal View History

2023-07-10 21:14:23 -07:00
{{- 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 -}}