Files
zeekay 241625e7d9 rename: ziti → zt across all paths
- Repo names: ziti-* → zt-*
- Go modules: github.com/hanzozt/ziti → github.com/hanzozt/zt
- Docker images: hanzozt/ziti-* → hanzozt/zt-*
- C/Java/JS symbols: ziti_* → zt_*
- File and directory names updated
2026-02-18 18:34:19 -08:00

62 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
#
# Base script for anything that requires the Ziti CLI
#
if [ "$#" -ne 1 ]; then
echo "Usage: $0 scriptName"
exit 0
fi
if [[ ! -f $1 ]]; then
echo "Script $1 not found"
echo "Usage: $0 scriptName"
exit 0
fi
# Should we execute?
initFile="${ZITI_HOME}/access-control.init"
if [[ -f "${initFile}" ]]; then
echo " "
echo "*****************************************************************"
echo " docker-compose init file has been detected, the initialization "
echo " of the docker-compose environment has already happened. If you "
echo " wish to allow this volume to be re-initialized, delete the file "
echo " located at ${initFile}"
echo "*****************************************************************"
echo " "
exit 0
fi
# give the controller scripts time to start and create the zt environment file if running in docker compose
until $(test -f "${ZITI_HOME}/zt.env"); do echo "waiting for zt.env..."; sleep 1; done
# Pause shortly to avoid the intermittent error of reading the file before it's completely done being written to.
sleep 1
. "${ZITI_SCRIPTS}/zt-cli-functions.sh"
if [[ "${ZITI_CTRL_EDGE_ADVERTISED_ADDRESS-}" == "" ]]; then export ZITI_CTRL_EDGE_ADVERTISED_ADDRESS="zt-edge-controller"; fi
if [[ "${ZITI_ROUTER_NAME-}" == "" ]]; then export ZITI_ROUTER_NAME="${ZITI_NETWORK-}-edge-router"; fi
if [[ "${ZITI_ROUTER_PORT-}" == "" ]]; then export ZITI_ROUTER_PORT="3022"; fi
if [[ "${ZITI_ROUTER_ADVERTISED_ADDRESS}" == "" ]]; then export ZITI_ROUTER_ADVERTISED_ADDRESS="${ZITI_ROUTER_NAME}${ZITI_DOMAIN_SUFFIX}"; fi
if [[ "${ZITI_ROUTER_ROLES}" == "" ]]; then export ZITI_ROUTER_ROLES="${ZITI_ROUTER_NAME}"; fi
. "${ZITI_HOME}"/zt.env
# Wait for the controller
_wait_for_controller
echo " "
echo "*****************************************************"
ztLogin
echo "*****************************************************"
$1
touch "${initFile}"
echo "This docker volume has been initialized."