#!/usr/bin/env bash

# Set's up environment variables used in the various 'hpa*' scripts.
#
# This allows them all to be set / declared in one place, then those
# scripts just need to source this file to use them.
#
# All variables can be overriden by setting in your shell env.

# XDG vars.
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}

# Docker vars.
HPA_DOCKER_IMAGE="git.housh.dev/michael/swift-hpa"
HPA_DOCKER_TAG=${HPA_DOCKER_TAG:-"latest"}

# Auto pull options to be ran before running the hpa docker
# container, default is always pull new images and repositories.
HPA_AUTO_PULL=${HPA_AUTO_PULL:="1"}
HPA_AUTO_PULL_INTERVAL="3600" # 1 hour
HPA_AUTO_PULL_OPTS=${HPA_AUTO_PULL_OPTS:-"--all"}

HPA_CONFIG_DIR="$XDG_CONFIG_HOME/hpa"
HPA_DATA_DIR="$XDG_DATA_HOME/hpa"
HPA_PLAYBOOK_DIR="$HPA_DATA_DIR/playbook"
HPA_PLAYBOOK_URL="ssh://git@git.housh.dev:2222/michael/ansible-hpa-playbook.git"
HPA_VAULT_SECRET_KEY="${HPA_VAULT_SECRET_KEY:-vault-pass}"

# Consults vars.
HPA_CONSULTS_DIR=${CONSULTS_DIR:-$HOME/work/consults}
HPA_CONSULT_ORIGIN_BASE_URL=${CONSULT_ORIGIN_BASE_URL:-"ssh://git@git.housh.dev:2222/consults"}
HPA_CONSULT_TEMPLATE_DIR=${HPA_DATA_DIR}/template
HPA_CONSULT_TEMPLATE_URL="ssh://git@git.housh.dev:2222/hhe/consult-template.git"

export HPA_AUTO_PULL
export HPA_AUTO_PULL_INTERVAL
export HPA_AUTO_PULL_OPTS
export HPA_CONSULTS_DIR
export HPA_CONSULT_ORIGIN_BASE_URL
export HPA_CONSULT_TEMPLATE_DIR
export HPA_CONSULT_TEMPLATE_URL
export HPA_CONFIG_DIR
export HPA_DATA_DIR
export HPA_DOCKER_IMAGE
export HPA_DOCKER_TAG
export HPA_PLAYBOOK_URL
export HPA_PLAYBOOK_DIR
export HPA_VAULT_SECRET_KEY
