7 Commits

9 changed files with 441 additions and 145 deletions

View File

@@ -109,10 +109,11 @@ update_dirs $DEV_ENV/env/.local $HOME/.local
# SCRIPTS # SCRIPTS
mkdir -p ~/.local/scripts/{hypr,utils} >/dev/null 2>&1 mkdir -p ~/.local/scripts/{hypr,utils} >/dev/null 2>&1
mkdir -p ~/.local/scripts/utils/kanatactl >/dev/null 2>&1 mkdir -p ~/.local/scripts/utils/{kanatactl,hpa} >/dev/null 2>&1
update_dirs $DEV_ENV/env/.local/scripts/hypr $HOME/.local/scripts/hypr update_dirs $DEV_ENV/env/.local/scripts/hypr $HOME/.local/scripts/hypr
copy_files $DEV_ENV/env/.local/scripts/hypr $HOME/.local/scripts/hypr copy_files $DEV_ENV/env/.local/scripts/hypr $HOME/.local/scripts/hypr
copy_files "$DEV_ENV/env/.local/scripts/utils/kanatactl" "$HOME/.local/scripts/utils/kanatactl" copy_files "$DEV_ENV/env/.local/scripts/utils/kanatactl" "$HOME/.local/scripts/utils/kanatactl"
copy_files "$DEV_ENV/env/.local/scripts/utils/hpa" "$HOME/.local/scripts/utils/hpa"
copy_files $DEV_ENV/env/.local/scripts $HOME/.local/scripts copy_files $DEV_ENV/env/.local/scripts $HOME/.local/scripts
# SYSTEMD # SYSTEMD

127
env/.local/scripts/hpa vendored
View File

@@ -7,114 +7,29 @@ set -o pipefail
# A wrapper script to run swift-hpa in a docker container and # A wrapper script to run swift-hpa in a docker container and
# mount the correct volumes, etc. # mount the correct volumes, etc.
# #
# To download templates, playbooks, setup secrets, generate shell completions, etc. # Make sure to run 'hpa-init' first on this machine to setup
# you can call this script with 'init'. # dependencies, if you have not done so already.
#
# Otherwise it will run the hpa script inside of a docker container with any passed
# in arguments.
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config} SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share} . "$SCRIPTS/utils/hpa/hpa.env"
HPA_DOCKER_IMAGE="git.housh.dev/michael/swift-hpa"
HPA_DOCKER_TAG=${HPA_DOCKER_TAG:-"latest"}
HPA_DATA_DIR="$XDG_DATA_HOME/hpa"
HPA_CONFIG_DIR="$XDG_CONFIG_HOME/hpa"
CONSULTS_DIR=${CONSULTS_DIR:-$HOME/work/consults}
CONSULT_TEMPLATE_URL="ssh://git@git.housh.dev:2222/hhe/consult-template.git"
HPA_PLAYBOOK_URL="ssh://git@git.housh.dev:2222/michael/ansible-hpa-playbook.git"
HPA_VAULT_SECRET_KEY="${HPA_VAULT_SECRET_KEY:-vault-pass}"
echoerr() {
echo -e "\e[31m[ERROR]:\e[0m $*"
}
generate-completion() {
local output_dir output type
type=${1:-"zsh"}
output=${2:-$HOME/.zsh/completions/_hpa}
output_dir=$(dirname "$output")
[[ ! -d "$output_dir" ]] && mkdir -p "$output_dir"
(
podman run --rm -it "$HPA_DOCKER_IMAGE:$HPA_DOCKER_TAG" \
--generate-completion-script "$type" |
tr -d '\r'
) >"$output"
}
gnnerate-secret() {
local secret=""
secret="$(pass -c ansible/vault-pass)"
printf "%s" "$secret" | podman secret create "$HPA_VAULT_SECRET_KEY" -
}
# Ensure the dependencies are installed / setup.
init() {
generate-completion "$@"
gnnerate-secret
mkdir -p "$CONSULTS_DIR" &>/dev/null
mkdir "$HPA_DATA_DIR" &>/dev/null
[[ ! -d "$HPA_DATA_DIR/playbook" ]] && git clone "$HPA_PLAYBOOK_URL" "$HPA_DATA_DIR/playbook"
[[ ! -d "$HPA_DATA_DIR/template" ]] && git clone "$CONSULT_TEMPLATE_URL" "$HPA_DATA_DIR/template"
}
run() {
podman run --rm -it \
--volume "$HPA_DATA_DIR/template":/template \
--volume "$HPA_DATA_DIR/playbook":/playbook \
--volume "$HPA_CONFIG_DIR":/config/hpa \
--volume "$CONSULTS_DIR":/consults \
--secret "$HPA_VAULT_SECRET_KEY" \
"$HPA_DOCKER_IMAGE:$HPA_DOCKER_TAG" "$@"
}
# Helper to generate the project directory properly.
#
# This allows project to be created using `hpa create Customer`, and the project
# will be created with an actual directory named '25.11.05.Customer'.
#
# This also handles setting parent directory to the `/consults` directory inside
# the container, otherwise the project fails to get created.
#
# We also suppress all output and then generate the actual directory path on the local
# file system.
#
# This is generally called by using the 'hpa-create' script, that shows a spinner and
# cleans up the output. Which is generally used like: `cd $(hpa-create Foo)` to automatically
# cd into the generated project and get to work.
create() {
local project project_container_name dir_name
project=${1:-""}
[[ -z $project ]] && echoerr "Must supply a project name." && exit 1
project_container_name="$(run create --quiet "/consults/$(date '+%Y.%m.%d').$project")"
dir_name="$CONSULTS_DIR/$(basename "$project_container_name")"
# Initialize git repo in the project and the initial commit.
pushd "$(echo "$dir_name" | tr -d '\r' | head -1)" &>/dev/null || exit 1
(
git init
git add .
git commit --all --message="Initial commit"
) &>/dev/null
popd &>/dev/null
echo "$dir_name"
}
############################## MAIN ############################## ############################## MAIN ##############################
first_arg=${1:-""} last_pull="0"
if [[ -f "$HPA_CONFIG_DIR/.lastpull" ]]; then
if [[ $first_arg == "init" ]]; then last_pull=$(cat "$HPA_CONFIG_DIR/.lastpull")
shift
init "$@"
elif [[ $first_arg == "create" ]]; then
shift
echo "$(create "$@")"
else
run "$@"
fi fi
curr=$(date +%s)
diff=$((curr - last_pull))
if [[ $HPA_AUTO_PULL == "1" ]] && [[ $diff -gt "$HPA_AUTO_PULL_INTERVAL" ]]; then
. "$SCRIPTS/hpa-pull" "$HPA_AUTO_PULL_OPTS"
fi
podman run --rm --interactive --tty \
--volume "$HPA_DATA_DIR/template":/template \
--volume "$HPA_DATA_DIR/playbook":/playbook \
--volume "$HPA_CONFIG_DIR":/config/hpa \
--volume "$HPA_CONSULTS_DIR":/consults \
--secret "$HPA_VAULT_SECRET_KEY" \
"$HPA_DOCKER_IMAGE:$HPA_DOCKER_TAG" "$@"

View File

@@ -1,31 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# NB: This wrapper script is required for the spinner to work, otherwise if declared in title="Creating project..."
# the 'hpa' (container wrapper script) then it doesn't work. script="${SCRIPTS:-$HOME/.local/scripts}/utils/hpa/hpa-create"
# https://github.com/charmbracelet/gum/issues/419
usage() {
cat <<'EOF'
Create a home performance assesment project directory. This handles creating the project using
the preferred directory name (example '25.11.05.McTestface').
It show's a spinner while the project is being created and supresses all output except for the
generated directory. This allows the command to be called using `cd $(hpa-create McTestface)` to
cd into the directory once it's created and get to work!
USAGE:
$ hpa-create <FLAGS> <CUSTOMER>
FLAGS:
-h | --help: Show this help page.
EOF
}
first_arg=${1:-""} first_arg=${1:-""}
if [[ $first_arg == "-h" ]] || [[ $first_arg == "--help" ]]; then if [[ $first_arg == "-h" ]] || [[ $first_arg == "--help" ]]; then
usage && exit 0 . "$script" $*
else else
gum spin --show-output --title "Creating project..." -- bash -c "hpa create $*" | tr -d '\r' | head -1 gum spin --show-output --title "$title" -- bash -c "$script $*" | tr -d '\r' | head -1
fi fi

97
env/.local/scripts/hpa-init vendored Executable file
View File

@@ -0,0 +1,97 @@
#!/usr/bin/env bash
set -e
set -o nounset
set -o pipefail
SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
THIS_FILE=${BASH_SOURCE[0]}
LOG_LABEL=$(basename "$THIS_FILE")
THIS=${THIS:-$LOG_LABEL}
LOG_FILE=${LOG_FILE:-"$LOG_LABEL.log"}
# Load environment / shared variables.
. "$SCRIPTS/utils/hpa/hpa.env"
usage() {
cat <<EOF
Setup dependencies for running hpa script in docker. This only needs to be
ran once on a new machine.
USAGE:
$ $THIS <flags> <shell> <completion-file>
FLAGS:
-h | --help: Show this help page.
DEFAULTS:
shell: Default is 'zsh', accepts 'zsh' | 'bash' | 'fish'
completion-file: Default is '~/.zsh/completions/_hpa'
ENVIRONMENT:
CONSULTS_DIR: Set the directory where consults / projects are stored.
(default: '~/work/consults')
HPA_DOCKER_TAG: Set the docker image tag to use for the hpa docker image
(default: 'latest')
HPA_VAULT_SECRET_KEY: Set the key used for the ansible-vault secret.
(default: 'vault-pass')
EOF
}
# Logging utility function, use in place of echo.
log() {
logging log --source "$THIS_FILE" "$@"
}
generate-completion() {
local output_dir output type
type=${1:-"zsh"}
output=${2:-$HOME/.zsh/completions/_hpa}
output_dir=$(dirname "$output")
log "Generating completion: type: '$type', to: $output"
[[ ! -d "$output_dir" ]] && mkdir -p "$output_dir"
(
podman run --rm -it "$HPA_DOCKER_IMAGE:$HPA_DOCKER_TAG" \
--generate-completion-script "$type" |
tr -d '\r'
) >"$output"
}
generate-secret() {
log "Generating vault secret for key: '$HPA_VAULT_SECRET_KEY'"
local secret
secret="$(pass -c ansible/vault-pass)"
printf "%s" "$secret" | podman secret create "$HPA_VAULT_SECRET_KEY" -
}
################################################################################
# MAIN
################################################################################
first_arg=${1:-""}
if [[ $first_arg == "-h" ]] || [[ $first_arg == "--help" ]]; then
usage && exit 0
else
# Setup logging file and label.
source "$SCRIPTS/hypr/logging"
setup-logging "$LOG_FILE" "$LOG_LABEL"
log "Starting init..."
generate-completion "$@"
generate-secret
log "Generating directories, if they don't exist."
mkdir -p "$HPA_CONSULTS_DIR" &>/dev/null
mkdir "$HPA_DATA_DIR" &>/dev/null
log "Cloning required template and playbook, if they don't exist"
[[ ! -d "$HPA_PLAYBOOK_DIR" ]] && git clone "$HPA_PLAYBOOK_URL" "$HPA_PLAYBOOK_DIR"
[[ ! -d "$HPA_CONSULT_TEMPLATE_DIR" ]] && git clone "$HPA_CONSULT_TEMPLATE_URL" "$HPA_CONSULT_TEMPLATE_DIR"
fi

108
env/.local/scripts/hpa-pull vendored Executable file
View File

@@ -0,0 +1,108 @@
#!/usr/bin/env bash
set -e
set -o nounset
set -o pipefail
SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
THIS_FILE=${BASH_SOURCE[0]}
LOG_LABEL=$(basename "$THIS_FILE")
THIS=${THIS:-$LOG_LABEL}
LOG_FILE=${LOG_FILE:-"$LOG_LABEL.log"}
# Load environment / shared variables.
. "$SCRIPTS/utils/hpa/hpa.env"
usage() {
cat <<EOF
Pulls / updates template, playbook, docker image, etc.
USAGE:
$ $THIS <flags>
FLAGS:
-a | --all: Pull everything (default).
-d | --docker: Pull docker image.
-p | --playbook: Pull ansible-hpa-playbook.
-t | --template: Pull consult template.
-h | --help: Show this help page.
If no flags are passed in then we will pull everything.
EOF
}
# Logging utility function, use in place of echo.
log() {
logging log --source "$THIS_FILE" "$@"
}
pull-repo() {
local dir=${1:-""}
[[ -z "$dir" ]] &&
log --error "Directory not supplied to pull git repo." &&
exit 1
pushd "$dir" &>/dev/null || exit 1
(
git pull
)
popd &>/dev/null
}
pull-docker() {
log --echo "Pulling docker image: '$HPA_DOCKER_IMAGE:$HPA_DOCKER_TAG'"
podman pull "$HPA_DOCKER_IMAGE:$HPA_DOCKER_TAG"
}
pull-playbook() {
log --echo "Pulling playbook: '$HPA_PLAYBOOK_DIR'"
pull-repo "$HPA_PLAYBOOK_DIR"
}
pull-template() {
log --echo "Pulling template: '$HPA_CONSULT_TEMPLATE_DIR'"
pull-repo "$HPA_CONSULT_TEMPLATE_DIR"
}
################################################################################
# MAIN
################################################################################
# Setup logging file and label.
source "$SCRIPTS/hypr/logging"
setup-logging "$LOG_FILE" "$LOG_LABEL"
all_flag="1"
docker_flag="0"
playbook_flag="0"
template_flag="0"
while [[ $# -gt 0 ]]; do
if [[ $1 == "-a" ]] || [[ $1 == "--all" ]]; then
all_flag="1"
break
elif [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
usage && exit 0
elif [[ $1 == "-d" ]] || [[ $1 == "--docker" ]]; then
all_flag="0"
docker_flag="1"
elif [[ $1 == "-p" ]] || [[ $1 == "--playbook" ]]; then
all_flag="0"
playbook_flag="1"
elif [[ $1 == "-t" ]] || [[ $1 == "--template" ]]; then
all_flag="0"
template_flag="1"
fi
shift
done
if [[ $all_flag == "1" ]]; then
docker_flag="1"
playbook_flag="1"
template_flag="1"
fi
[[ $docker_flag == "1" ]] && pull-docker
[[ $playbook_flag == "1" ]] && pull-playbook
[[ $template_flag == "1" ]] && pull-template
echo "$(date +%s)" >>$HPA_CONFIG_DIR/.lastpull

View File

@@ -43,14 +43,14 @@ warn_flag="0"
error_flag="0" error_flag="0"
__msg() { __msg() {
if [[ -z "$@" ]]; then if [[ -z "$*" ]]; then
echo -e "\e[31m[ERROR]:\e[0m No logs were supplied." echo -e "\e[31m[ERROR]:\e[0m No logs were supplied."
exit 1 exit 1
fi fi
if [[ $warn_flag == "1" ]]; then if [[ $warn_flag == "1" ]]; then
echo -e "\e[33m[WARN]:\e[0m $@" echo -e "\e[33m[WARN]:\e[0m $*"
elif [[ $error_flag == "1" ]]; then elif [[ $error_flag == "1" ]]; then
echo -e "\e[31m[ERROR]:\e[0m $@" echo -e "\e[31m[ERROR]:\e[0m $*"
else else
echo "$@" echo "$@"
fi fi
@@ -72,6 +72,7 @@ logging() {
# Reset flags # Reset flags
log_flag="0" log_flag="0"
echo_flag="0"
warn_flag="0" warn_flag="0"
error_flag="0" error_flag="0"
source_file="" source_file=""
@@ -79,11 +80,11 @@ logging() {
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
if [[ $1 == "-w" ]] || [[ $1 == "--warn" ]] || [[ $1 == "--warning" ]]; then if [[ $1 == "-w" ]] || [[ $1 == "--warn" ]] || [[ $1 == "--warning" ]]; then
log_flag="1"
warn_flag="1" warn_flag="1"
elif [[ $1 == "-e" ]] || [[ $1 =~ ^--error ]]; then elif [[ $1 == "-e" ]] || [[ $1 =~ ^--error ]]; then
log_flag="1"
error_flag="1" error_flag="1"
elif [[ $1 =~ ^--echo ]]; then
echo_flag="1"
elif [[ $1 == "-s" ]] || [[ $1 =~ ^--source ]]; then elif [[ $1 == "-s" ]] || [[ $1 =~ ^--source ]]; then
shift shift
source_file="$1" source_file="$1"
@@ -100,20 +101,21 @@ logging() {
exit 1 exit 1
fi fi
if [[ -z $args ]]; then if [[ -z "${args[*]}" ]]; then
echo -e "\e[31m[ERROR]:\e[0m No log message supplied." echo -e "\e[31m[ERROR]:\e[0m No log message supplied."
exit 1 exit 1
fi fi
msg="$(__msg ${args[@]})" msg="$(__msg "${args[@]}")"
if [[ $LOG_ENABLE_DRY_RUN == "0" ]]; then if [[ $LOG_ENABLE_DRY_RUN == "0" ]] && [[ $log_flag == "1" ]]; then
# Loop over log files logging message to each file. # Loop over log files logging message to each file.
for i in "${!LOG_FILE[@]}"; do for i in "${!LOG_FILE[@]}"; do
local file=${LOG_DIR}/${LOG_FILE[i]} local file=${LOG_DIR}/${LOG_FILE[i]}
local id=$LOG_INVOCATION_ID local id=$LOG_INVOCATION_ID
local label=${LOG_LABEL[i]:-"$LOG_LABEL"} local label=${LOG_LABEL[i]:-"$LOG_LABEL"}
local time=$(date '+%D %H:%M:%S') local time
time=$(date '+%D %H:%M:%S')
if [[ -z $file ]] || [[ -z $id ]] || [[ -z $label ]]; then if [[ -z $file ]] || [[ -z $id ]] || [[ -z $label ]]; then
echo "Logging not properly setup." echo "Logging not properly setup."
@@ -130,6 +132,8 @@ logging() {
echo -e "[id: $id]$msg" echo -e "[id: $id]$msg"
elif [[ $warn_flag == "1" ]]; then elif [[ $warn_flag == "1" ]]; then
echo -e "[id: $id]$msg" echo -e "[id: $id]$msg"
elif [[ $echo_flag == "1" ]]; then
echo -e "$msg"
fi fi
else else
# Dry run mode, so just log to the console # Dry run mode, so just log to the console
@@ -168,7 +172,7 @@ setup-logging() {
if [[ -n $LOG_LABEL ]] && [[ ! $LOG_LABEL =~ $label ]]; then if [[ -n $LOG_LABEL ]] && [[ ! $LOG_LABEL =~ $label ]]; then
LOG_LABEL+=("${LOG_LABEL[@]}=>$label") LOG_LABEL+=("${LOG_LABEL[@]}=>$label")
elif [[ ! $LOG_LABEL =~ $label ]]; then elif [[ ! ${LOG_LABEL[*]} =~ $label ]]; then
LOG_LABEL+=("$label") LOG_LABEL+=("$label")
fi fi
@@ -179,9 +183,9 @@ setup-logging() {
} }
print_logger_env() { print_logger_env() {
echo "LOG_FILE: ${LOG_FILE[@]}" echo "LOG_FILE: ${LOG_FILE[*]}"
echo "LOG_INVOCATION_ID: $LOG_INVOCATION_ID" echo "LOG_INVOCATION_ID: $LOG_INVOCATION_ID"
echo "LOG_LABEL: ${LOG_LABEL[@]}" echo "LOG_LABEL: ${LOG_LABEL[*]}"
} }
export -f setup-logging export -f setup-logging

143
env/.local/scripts/utils/hpa/hpa-create vendored Executable file
View File

@@ -0,0 +1,143 @@
#!/usr/bin/env bash
set -e
set -o nounset
set -o pipefail
# NOTE: This script is required so that we can use 'gum spin' during creation
# of the project, otherwise the spinner doesn't actually show up when
# the utility functions live in the same file.
# https://github.com/charmbracelet/gum/issues/419
SCRIPTS=${SCRIPTS:-$HOME/.local/scripts}
THIS_FILE=${BASH_SOURCE[0]}
LOG_LABEL=$(basename "$THIS_FILE")
THIS=${THIS:-$LOG_LABEL}
LOG_FILE=${LOG_FILE:-"$LOG_LABEL.log"}
# Load environment / shared variables.
. "$SCRIPTS/utils/hpa/hpa.env"
declare no_git_flag no_push_flag date_opt
no_git_flag="0"
no_push_flag="0"
date_opt=$(date '+%Y.%m.%d')
usage() {
cat <<EOF
A utility script to generate a new home performance assessment project.
All output from the 'hpa' command get suppressed so that this script can
be piped / used to automatically cd into the directory after creation to
quickly get to work on the new project.
This generates projects directories with the format of '2025.11.06.Customer',
will appropriately set the directory to use inside the docker container used
to generate the project, and then echo the local directory that was created.
It also initializes the project as a git repository.
USAGE:
$ $THIS <flags> <customer>
FLAGS:
-d | --date: Override the date the project was started.
-g | --no-git: Do not initialize a git repository for the project.
-h | --help: Show this help page.
-p | --no-push: Do not push project to remote repository.
ENVIRONMENT:
CONSULTS_DIR: Sets the location of new porjects
(default: ~/work/consults)
CONSULT_ORIGIN_BASE_URL: Sets the base url for the project git origin.
(default: ssh://git@git.housh.dev:2222/consults)
EOF
}
# Logging utility function, use in place of echo.
log() {
logging log --source "$THIS_FILE" "$@"
}
create() {
local customer container_dir
customer=${1:-""}
[[ -z $customer ]] &&
log --error "Must supply a customer name for the project" &&
exit 1
[[ ! -f $SCRIPTS/hpa ]] &&
log --error "Unable to find the 'hpa' script." &&
exit 1
log "Generating project for: '$customer'"
container_dir=$(
"$SCRIPTS/hpa" create --quiet "/consults/$date_opt.$customer"
)
echo "$HPA_CONSULTS_DIR/$(basename "$container_dir")"
}
initialize-git() {
local dir
read -r dir
dir=$(echo "$dir" | tr -d '\r' | head -1)
if [[ $no_git_flag == "0" ]]; then
[[ ! -d $dir ]] &&
log --error "Could not initialize git directory not found: '$dir'" &&
exit 1
log "Initializing git repository"
pushd "$dir" &>/dev/null || exit 1
(
git init
git add .
git commit --all --message="Initial commit"
git remote add origin "$HPA_CONSULT_ORIGIN_BASE_URL/$(basename "$dir")"
if [[ $no_push_flag == "0" ]]; then
git push --set-upstream origin main
fi
) &>/dev/null
popd &>/dev/null
else
log "Skipping git initialization"
fi
echo "$dir"
}
################################################################################
# MAIN
################################################################################
# Setup logging file and label.
source "$SCRIPTS/hypr/logging"
setup-logging "$LOG_FILE" "$LOG_LABEL"
declare customer output
while [[ $# -gt 0 ]]; do
if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
usage && exit 0
elif [[ $1 == "-d" ]] || [[ $1 == "--date" ]]; then
shift
date_opt="$1"
elif [[ $1 == "-g" ]] || [[ $1 == "--no-git" ]]; then
no_git_flag="1"
elif [[ $1 == "-p" ]] || [[ $1 == "--no-push" ]]; then
no_push_flag="1"
else
customer=$1
fi
shift
done
output=$(create "$customer" | initialize-git)
echo "$output"

49
env/.local/scripts/utils/hpa/hpa.env vendored Executable file
View File

@@ -0,0 +1,49 @@
#!/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

2
env/.zshenv vendored
View File

@@ -68,7 +68,7 @@ export VAULT_ADDR="https://vault.housh.dev"
export CARGO_HOME="$XDG_DATA_HOME/cargo" export CARGO_HOME="$XDG_DATA_HOME/cargo"
# Tmux-Sessionator path. # Tmux-Sessionator path.
export TMUX_SESSIONATOR_PATH="$HOME:$SCRIPTS:$HOME/.config/personal:$HOME/dev:$HOME/dev/homelab/utils:$HOME/dev/homelab/services" export TMUX_SESSIONATOR_PATH="$HOME:$SCRIPTS:$HOME/.config/personal:$HOME/dev:$HOME/dev/homelab/utils:$HOME/dev/homelab/services:$HOME/work/consults:$HOME/work"
# Password-store # Password-store
# export PASSWORD_STORE_DIR="$XDG_DATA_HOME/gopass/stores/root" # export PASSWORD_STORE_DIR="$XDG_DATA_HOME/gopass/stores/root"