#!/bin/bash

if [ -z "${ENV}" ]; then \
		echo "Error: ENV variable is not defined. Please set to one of development|staging|production"; exit 1; \
fi

if [ "${ENV}" == "development" ]; then \
    echo "Flux is not used in development environment. Skipping."
		exit 0
fi

# flux bootstrap git \
#   --kubeconfig /home/cj/.kube/vke.yaml \
#   --url=https://gitea.futureporn.net/futureporn/fp.git \
#   --branch=main \
#   --username=cj_clippy \
#   --token-auth=true \
#   --path=clusters/production

## --silent avoids the [Yes|no] prompt
flux bootstrap git \
  --silent \
  --url="ssh://git@gitea.futureporn.net:2222/futureporn/fp" \
  --branch=main \
  --path="flux/clusters/$ENV" \
  --private-key-file=/home/cj/.ssh/fp-flux