client: src: refactor environment/gen handler

- Moves environment handling from `lib_gen` to `lib_env`
- Related refactoring
This commit is contained in:
2024-09-22 18:31:55 -07:00
parent b2fcb02225
commit d8222c60fb
4 changed files with 351 additions and 298 deletions

View File

@@ -58,7 +58,7 @@ function lib_docker::__docker()
[ -z "$global_platform" ] && lib_utils::die_fatal
[ -z "$global_tag" ] && lib_utils::die_fatal
# Inherited from caller (via lib_gen)
# Inherited from caller (via `lib_env`)
[ -z "$global_client_version" ] && lib_utils::die_fatal
[ -z "$global_repo_dockerfiles" ] && lib_utils::die_fatal

View File

@@ -0,0 +1,321 @@
#!/usr/bin/env bash
# docker-finance | modern accounting for the power-user
#
# Copyright (C) 2021-2024 Aaron Fiore (Founder, Evergreen Crypto LLC)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
[ -z "$DOCKER_FINANCE_CLIENT_REPO" ] && exit 1
#
# "Libraries"
#
# Utilities (a container library (but container is never exposed to client code))
source "${DOCKER_FINANCE_CLIENT_REPO}/container/src/finance/lib/internal/lib_utils.bash" || exit 1
#
# Implementation
#
if [ $UID -lt 1000 ]; then
lib_utils::die_fatal "Do not run as root or system user!"
fi
# IMPORTANT: keep umask for security
umask o-rwx
if ! docker compose version 1>/dev/null; then
lib_utils::die_fatal "Docker compose plugin not installed"
fi
if [ -z "$EDITOR" ]; then
editors=("vim" "vi" "emacs" "nano")
for editor in "${editors[@]}"; do
hash "$editor" &>/dev/null && export EDITOR="$editor" && break
done
if [ $? -ne 0 ]; then
lib_utils::die_fatal "Shell EDITOR is not set, export EDITOR in your shell"
fi
fi
#
# "Constructor" for environment generation
#
# 1. Sets client-side environment with defaults or use existing environment
# 2. If configured, resets to alternative environment configuration after bootstrap
#
# NOTE: some bootstrapped defaults are ignored by environment file (as seen below)
#
function lib_env::env()
{
[ -z "$DOCKER_FINANCE_CLIENT_REPO" ] && lib_utils::die_fatal
# NOTE: global_* *MUST* be reset after sourcing new env file
#
# Generate `docker-finance` version
#
global_repo_manifest="${DOCKER_FINANCE_CLIENT_REPO}/client/docker-finance.yaml"
declare -g global_repo_manifest
global_client_version="$(grep '^version: ' $global_repo_manifest | sed -e 's/version: "//' -e 's/"//g')"
# shellcheck disable=SC2034 # used during env gen
declare -g global_client_version
#
# If empty environment:
#
# 1. Poke at possible (default) location of end-user environment file
# a. If found, point to new location and read/reset from there
#
# 2. If file not found, bootstrap with defaults
#
# Environment (end-user)
global_conf_filename="${USER}@$(uname -n)"
declare -g global_conf_filename
# Environment (end-user) tag dir (not full path)
[ -z "$global_tag" ] && lib_utils::die_fatal
global_tag_dir="client/$(uname -s)-$(uname -m)/${global_platform}/${global_tag}"
declare -g global_tag_dir
local _env_dir="/home/${USER}/.config/docker-finance.d/${global_tag_dir}/env" # NOTE: keep aligned with gen.bash
local _env_file="${_env_dir}/${global_conf_filename}"
# shellcheck source=/dev/null
[ -f "$_env_file" ] && source "$_env_file"
if [ -z "$DOCKER_FINANCE_CLIENT_CONF" ]; then
# shellcheck source=/dev/null
source "${DOCKER_FINANCE_CLIENT_REPO}/client/docker-finance.d/client/env/gen.bash"
fi
[ -z "$DOCKER_FINANCE_CLIENT_CONF" ] \
&& lib_utils::die_fatal "Defaults not generated! (${global_repo_env_file})"
lib_env::__set_client_globals
#
# Reset environment with user-provided (user-defined) existing file (if available)
#
_env_dir="${DOCKER_FINANCE_CLIENT_CONF}/${global_tag_dir}/env"
_env_file="${_env_dir}/${global_conf_filename}"
if [ -f "$_env_file" ]; then
if [ -s "$_env_file" ]; then
# Re-bootstrap with (new) environment
lib_utils::print_debug "Environment found! Using '${_env_file}'"
lib_env::__read "$_env_file"
lib_env::__set_client_globals
else
lib_utils::print_warning \
"Client environment '${_env_file}' is empty! Writing defaults"
lib_env::__write "$_env_file"
fi
else
[ -z "$global_command" ] && lib_utils::die_fatal
[ -z "$global_basename" ] && lib_utils::die_fatal
if [[ -z "$global_command" || "$global_command" != "gen" ]]; then
lib_utils::die_fatal \
"Client environment not found! Run gen command'"
fi
lib_utils::print_info \
"Client environment not found, writing defaults to '${_env_file}'"
lib_env::__write "$_env_file"
fi
}
#
# Set client globals from environment
#
function lib_env::__set_client_globals()
{
lib_utils::print_debug "Setting (or resetting) client globals"
#
# Repository env
#
[ -z "$DOCKER_FINANCE_CLIENT_REPO" ] && lib_utils::die_fatal
# Generate `docker-finance` version
global_repo_manifest="${DOCKER_FINANCE_CLIENT_REPO}/client/docker-finance.yaml"
declare -g global_repo_manifest
lib_utils::print_debug "global_repo_manifest=${global_repo_manifest}"
global_client_version="$(grep '^version: ' $global_repo_manifest | sed -e 's/version: "//' -e 's/"//g')"
# shellcheck disable=SC2034 # used during env gen
declare -g global_client_version
lib_utils::print_debug "global_client_version=${global_client_version}"
# This does not reset when reading env; export again
export DOCKER_FINANCE_VERSION="$global_client_version"
lib_utils::print_debug "DOCKER_FINANCE_VERSION=${DOCKER_FINANCE_VERSION}"
# Repository-provided (not user-defined) default environment
global_repo_conf_dir="${DOCKER_FINANCE_CLIENT_REPO}/client/docker-finance.d"
declare -g global_repo_conf_dir
lib_utils::print_debug "global_repo_conf_dir=${global_repo_conf_dir}"
# Environment (repo)
declare -g global_repo_env_file="${global_repo_conf_dir}/client/env/gen.bash"
[ ! -f "$global_repo_env_file" ] \
&& lib_utils::die_fatal "Missing environment defaults! ($global_repo_env_file)"
lib_utils::print_debug "global_repo_env_file=${global_repo_env_file}"
#
# Repository env (Dockerfiles)
#
# Set image type
[ -z "$global_platform" ] && lib_utils::die_fatal
case "$global_platform" in
archlinux | ubuntu)
global_platform_image="finance"
;;
dev-tools)
global_platform_image="dev-tools"
;;
*)
lib_utils::die_fatal "unsupported platform"
;;
esac
declare -g global_platform_image
lib_utils::print_debug "global_platform_image=${global_platform_image}"
# Base location of Docker-related files (.in and final out files)
global_repo_dockerfiles="${DOCKER_FINANCE_CLIENT_REPO}/client/Dockerfiles/local/${global_platform_image}"
# shellcheck disable=SC2034 # used in lib_docker
declare -g global_repo_dockerfiles
lib_utils::print_debug "global_repo_dockerfiles=${global_repo_dockerfiles}"
# Base custom end-user .in Dockerfile (to be appended to final Dockerfile after installation)
declare -g global_repo_custom_dockerfile="${global_repo_conf_dir}/client/Dockerfiles/${global_platform_image}/Dockerfile.${global_platform}.in"
[ ! -f "$global_repo_custom_dockerfile" ] \
&& lib_utils::die_fatal "Missing default custom Dockerfile '${global_repo_custom_dockerfile}'"
lib_utils::print_debug "global_repo_custom_dockerfile=${global_repo_custom_dockerfile}"
#
# Client-side env
#
[ -z "$global_tag_dir" ] && lib_utils::die_fatal
# Environment (end-user) format
[ -z "$DOCKER_FINANCE_USER" ] && lib_utils::die_fatal
global_conf_filename="${DOCKER_FINANCE_USER}@$(uname -n)"
declare -g global_conf_filename
lib_utils::print_debug "global_conf_filename=${global_conf_filename}"
# Environment file (if available)
local _client_env_dir="${DOCKER_FINANCE_CLIENT_CONF}/${global_tag_dir}/env"
[ ! -d "$_client_env_dir" ] && mkdir -p "$_client_env_dir"
global_env_file="${_client_env_dir}/${global_conf_filename}"
lib_utils::print_debug "global_env_file=${global_env_file}"
# Custom Dockerfile (if available)
local _client_dockerfile_dir="${DOCKER_FINANCE_CLIENT_CONF}/${global_tag_dir}/Dockerfiles"
[ ! -d "$_client_dockerfile_dir" ] && mkdir -p "$_client_dockerfile_dir"
global_custom_dockerfile="${_client_dockerfile_dir}/${global_conf_filename}"
lib_utils::print_debug "global_custom_dockerfile=${global_custom_dockerfile}"
# NOTE:
#
# Client env tag format is avoided because:
#
# - We copy over static bash_aliases in Dockerfile,
# and superscript must be referenced by that static path
#
# - The needed dynamicness appears to not be satisfied via docker-compose
local _client_shell_dir="${DOCKER_FINANCE_CLIENT_CONF}/container/shell"
[ ! -d "$_client_shell_dir" ] && mkdir -p "$_client_shell_dir"
global_shell_file="${_client_shell_dir}/superscript.bash"
lib_utils::print_debug "global_shell_file=${global_shell_file}"
# Client view of client portion of repository
global_repo_client="${DOCKER_FINANCE_CLIENT_REPO}/client"
[ ! -d "$global_repo_client" ] && lib_utils::die_fatal "Repository '${global_repo_client}' not found!"
lib_utils::print_debug "global_repo_client=${global_repo_client}"
# Backup-file extension
# TODO: make configurable
global_suffix="$(date +%Y-%m-%d_%H:%M:%S)"
lib_utils::print_debug "global_suffix=${global_suffix}"
}
#
# Get/Set client-side environment with given file
#
function lib_env::__read()
{
local _file="$1"
# Get environment
local _env=()
while read _line; do
_env+=("$_line")
done < <(printenv | grep -Eo "^DOCKER_FINANCE[^=]+")
# Reset environment
for _line in "${_env[@]}"; do
lib_utils::print_debug "Unsetting $_line"
unset "$_line"
done
# Set, if a script that generates env
if [[ "$(head -n1 $_file)" =~ (bin|env|sh|bash) ]]; then
# shellcheck source=/dev/null
source "$global_repo_env_file"
return $?
fi
# Set, if env file format (docker / bash)
while read _line; do
# Ignore comments
if [[ ! "$_line" =~ ^# ]]; then
# Don't allow manipulating version via file
if [[ "$_line" =~ ^DOCKER_FINANCE_VERSION ]]; then
continue
fi
# Export valid line
export "${_line?}" # SC2163
lib_utils::print_debug "$_line"
fi
done <"$_file"
}
#
# Write client-side environment to given file
#
function lib_env::__write()
{
lib_utils::print_debug "Writing environment"
unset DOCKER_FINANCE_VERSION # Must be generated internally
printenv | grep -E "DOCKER_FINANCE" | sort >"$1"
}
# vim: sw=2 sts=2 si ai et

View File

@@ -23,305 +23,21 @@
# "Libraries"
#
# Runtime environment handler
source "${DOCKER_FINANCE_CLIENT_REPO}/client/src/docker/lib/internal/lib_env.bash" || exit 1
# Utilities (a container library (but container is never exposed to client code))
source "${DOCKER_FINANCE_CLIENT_REPO}/container/src/finance/lib/internal/lib_utils.bash" || exit 1
#
# Implementation
#
if [ $UID -lt 1000 ]; then
lib_utils::die_fatal "Do not run as root or system user!"
fi
# IMPORTANT: keep umask for security
umask o-rwx
if ! docker compose version 1>/dev/null; then
lib_utils::die_fatal "Docker compose plugin not installed"
fi
if [ -z "$EDITOR" ]; then
editors=("vim" "vi" "emacs" "nano")
for editor in "${editors[@]}"; do
hash "$editor" &>/dev/null && export EDITOR="$editor" && break
done
if [ $? -ne 0 ]; then
lib_utils::die_fatal "Shell EDITOR is not set, export EDITOR in your shell"
fi
fi
#
# "Constructor" for environment generation
#
# 1. Sets client-side environment with defaults or use existing environment
# 2. If configured, resets to alternative environment configuration after bootstrap
#
# NOTE: some bootstrapped defaults are ignored by environment file (as seen below)
# Generate new configurations or layout
#
function lib_gen::gen()
{
[ -z "$DOCKER_FINANCE_CLIENT_REPO" ] && lib_utils::die_fatal
# NOTE: global_* *MUST* be reset after sourcing new env file
#
# Generate `docker-finance` version
#
global_repo_manifest="${DOCKER_FINANCE_CLIENT_REPO}/client/docker-finance.yaml"
declare -g global_repo_manifest
global_client_version="$(grep '^version: ' $global_repo_manifest | sed -e 's/version: "//' -e 's/"//g')"
# shellcheck disable=SC2034 # used during env gen
declare -g global_client_version
#
# If empty environment:
#
# 1. Poke at possible (default) location of end-user environment file
# a. If found, point to new location and read/reset from there
#
# 2. If file not found, bootstrap with defaults
#
# Environment (end-user)
global_conf_filename="${USER}@$(uname -n)"
declare -g global_conf_filename
# Environment (end-user) tag dir (not full path)
[ -z "$global_tag" ] && lib_utils::die_fatal
global_tag_dir="client/$(uname -s)-$(uname -m)/${global_platform}/${global_tag}"
declare -g global_tag_dir
local _env_dir="/home/${USER}/.config/docker-finance.d/${global_tag_dir}/env" # NOTE: keep aligned with gen.bash
local _env_file="${_env_dir}/${global_conf_filename}"
# shellcheck source=/dev/null
[ -f "$_env_file" ] && source "$_env_file"
if [ -z "$DOCKER_FINANCE_CLIENT_CONF" ]; then
# shellcheck source=/dev/null
source "${DOCKER_FINANCE_CLIENT_REPO}/client/docker-finance.d/client/env/gen.bash"
fi
[ -z "$DOCKER_FINANCE_CLIENT_CONF" ] \
&& lib_utils::die_fatal "Defaults not generated! (${global_repo_env_file})"
lib_gen::__set_client_globals
#
# Reset environment with user-provided (user-defined) existing file (if available)
#
_env_dir="${DOCKER_FINANCE_CLIENT_CONF}/${global_tag_dir}/env"
_env_file="${_env_dir}/${global_conf_filename}"
if [ -f "$_env_file" ]; then
if [ -s "$_env_file" ]; then
# Re-bootstrap with (new) environment
lib_utils::print_debug "Environment found! Using '${_env_file}'"
lib_gen::__read_env "$_env_file"
lib_gen::__set_client_globals
else
lib_utils::print_warning \
"Client environment '${_env_file}' is empty! Writing defaults"
lib_gen::__write_env "$_env_file"
fi
else
[ -z "$global_command" ] && lib_utils::die_fatal
[ -z "$global_basename" ] && lib_utils::die_fatal
if [[ -z "$global_command" || "$global_command" != "gen" ]]; then
lib_utils::die_fatal \
"Client environment not found! Run gen command'"
fi
lib_utils::print_info \
"Client environment not found, writing defaults to '${_env_file}'"
lib_gen::__write_env "$_env_file"
fi
}
#
# Set client globals from environment
#
function lib_gen::__set_client_globals()
{
lib_utils::print_debug "Setting (or resetting) client globals"
#
# Repository env
#
[ -z "$DOCKER_FINANCE_CLIENT_REPO" ] && lib_utils::die_fatal
# Generate `docker-finance` version
global_repo_manifest="${DOCKER_FINANCE_CLIENT_REPO}/client/docker-finance.yaml"
declare -g global_repo_manifest
lib_utils::print_debug "global_repo_manifest=${global_repo_manifest}"
global_client_version="$(grep '^version: ' $global_repo_manifest | sed -e 's/version: "//' -e 's/"//g')"
# shellcheck disable=SC2034 # used during env gen
declare -g global_client_version
lib_utils::print_debug "global_client_version=${global_client_version}"
# This does not reset when reading env; export again
export DOCKER_FINANCE_VERSION="$global_client_version"
lib_utils::print_debug "DOCKER_FINANCE_VERSION=${DOCKER_FINANCE_VERSION}"
# Repository-provided (not user-defined) default environment
global_repo_conf_dir="${DOCKER_FINANCE_CLIENT_REPO}/client/docker-finance.d"
declare -g global_repo_conf_dir
lib_utils::print_debug "global_repo_conf_dir=${global_repo_conf_dir}"
# Environment (repo)
declare -g global_repo_env_file="${global_repo_conf_dir}/client/env/gen.bash"
[ ! -f "$global_repo_env_file" ] \
&& lib_utils::die_fatal "Missing environment defaults! ($global_repo_env_file)"
lib_utils::print_debug "global_repo_env_file=${global_repo_env_file}"
#
# Repository env (Dockerfiles)
#
# Set image type
[ -z "$global_platform" ] && lib_utils::die_fatal
case "$global_platform" in
archlinux | ubuntu)
global_platform_image="finance"
;;
dev-tools)
global_platform_image="dev-tools"
;;
*)
lib_utils::die_fatal "unsupported platform"
;;
esac
declare -g global_platform_image
lib_utils::print_debug "global_platform_image=${global_platform_image}"
# Base location of Docker-related files (.in and final out files)
global_repo_dockerfiles="${DOCKER_FINANCE_CLIENT_REPO}/client/Dockerfiles/local/${global_platform_image}"
# shellcheck disable=SC2034 # used in lib_docker
declare -g global_repo_dockerfiles
lib_utils::print_debug "global_repo_dockerfiles=${global_repo_dockerfiles}"
# Base custom end-user .in Dockerfile (to be appended to final Dockerfile after installation)
declare -g global_repo_custom_dockerfile="${global_repo_conf_dir}/client/Dockerfiles/${global_platform_image}/Dockerfile.${global_platform}.in"
[ ! -f "$global_repo_custom_dockerfile" ] \
&& lib_utils::die_fatal "Missing default custom Dockerfile '${global_repo_custom_dockerfile}'"
lib_utils::print_debug "global_repo_custom_dockerfile=${global_repo_custom_dockerfile}"
#
# Client-side env
#
[ -z "$global_tag_dir" ] && lib_utils::die_fatal
# Environment (end-user) format
[ -z "$DOCKER_FINANCE_USER" ] && lib_utils::die_fatal
global_conf_filename="${DOCKER_FINANCE_USER}@$(uname -n)"
declare -g global_conf_filename
lib_utils::print_debug "global_conf_filename=${global_conf_filename}"
# Environment file (if available)
local _client_env_dir="${DOCKER_FINANCE_CLIENT_CONF}/${global_tag_dir}/env"
[ ! -d "$_client_env_dir" ] && mkdir -p "$_client_env_dir"
global_env_file="${_client_env_dir}/${global_conf_filename}"
lib_utils::print_debug "global_env_file=${global_env_file}"
# Custom Dockerfile (if available)
local _client_dockerfile_dir="${DOCKER_FINANCE_CLIENT_CONF}/${global_tag_dir}/Dockerfiles"
[ ! -d "$_client_dockerfile_dir" ] && mkdir -p "$_client_dockerfile_dir"
global_custom_dockerfile="${_client_dockerfile_dir}/${global_conf_filename}"
lib_utils::print_debug "global_custom_dockerfile=${global_custom_dockerfile}"
# NOTE:
#
# Client env tag format is avoided because:
#
# - We copy over static bash_aliases in Dockerfile,
# and superscript must be referenced by that static path
#
# - The needed dynamicness appears to not be satisfied via docker-compose
local _client_shell_dir="${DOCKER_FINANCE_CLIENT_CONF}/container/shell"
[ ! -d "$_client_shell_dir" ] && mkdir -p "$_client_shell_dir"
global_shell_file="${_client_shell_dir}/superscript.bash"
lib_utils::print_debug "global_shell_file=${global_shell_file}"
# Client view of client portion of repository
global_repo_client="${DOCKER_FINANCE_CLIENT_REPO}/client"
[ ! -d "$global_repo_client" ] && lib_utils::die_fatal "Repository '${global_repo_client}' not found!"
lib_utils::print_debug "global_repo_client=${global_repo_client}"
# Backup-file extension
# TODO: make configurable
global_suffix="$(date +%Y-%m-%d_%H:%M:%S)"
lib_utils::print_debug "global_suffix=${global_suffix}"
}
#
# Get/Set client-side environment with given file
#
function lib_gen::__read_env()
{
local _file="$1"
# Get environment
local _env=()
while read _line; do
_env+=("$_line")
done < <(printenv | grep -Eo "^DOCKER_FINANCE[^=]+")
# Reset environment
for _line in "${_env[@]}"; do
lib_utils::print_debug "Unsetting $_line"
unset "$_line"
done
# Set, if a script that generates env
if [[ "$(head -n1 $_file)" =~ (bin|env|sh|bash) ]]; then
# shellcheck source=/dev/null
source "$global_repo_env_file"
return $?
fi
# Set, if env file format (docker / bash)
while read _line; do
# Ignore comments
if [[ ! "$_line" =~ ^# ]]; then
# Don't allow manipulating version via file
if [[ "$_line" =~ ^DOCKER_FINANCE_VERSION ]]; then
continue
fi
# Export valid line
export "${_line?}" # SC2163
lib_utils::print_debug "$_line"
fi
done <"$_file"
}
#
# Write client-side environment to given file
#
function lib_gen::__write_env()
{
lib_utils::print_debug "Writing environment"
unset DOCKER_FINANCE_VERSION # Must be generated internally
printenv | grep -E "DOCKER_FINANCE" | sort >"$1"
}
#
# Generate new configurations
#
function lib_gen::generate()
{
lib_utils::print_custom "\n"
lib_utils::print_info "Generating client/container environment"
@@ -330,6 +46,7 @@ function lib_gen::generate()
lib_gen::__gen_client
if [ $? -eq 0 ]; then
[ -z "$global_platform" ] && lib_utils::die_fatal
if [ "$global_platform" != "dev-tools" ]; then
lib_gen::__gen_container
fi
@@ -345,11 +62,18 @@ function lib_gen::generate()
function lib_gen::__gen_client()
{
[ -z "$global_suffix" ] && lib_utils::die_fatal
[ -z "$EDITOR" ] && lib_utils::die_fatal
lib_utils::print_debug "Generating client"
#
# Client-side environment file
#
#
[ -z "$global_env_file" ] && lib_utils::die_fatal
[ -z "$global_repo_env_file" ] && lib_utils::die_fatal
# Backup existing file
if [ -f "$global_env_file" ]; then
@@ -365,10 +89,10 @@ function lib_gen::__gen_client()
# Get/Set with repository defaults
lib_utils::print_debug "Reading $global_repo_env_file"
lib_gen::__read_env "$global_repo_env_file"
lib_env::__read "$global_repo_env_file"
lib_utils::print_debug "Writing $global_env_file"
lib_gen::__write_env "$global_env_file"
lib_env::__write "$global_env_file"
fi
fi
@@ -378,13 +102,16 @@ function lib_gen::__gen_client()
[[ "$_confirm" == [yY] ]] && $EDITOR "$global_env_file"
# Get/Set new (edited) environment variables
lib_gen::__read_env "$global_env_file"
lib_gen::__set_client_globals
lib_env::__read "$global_env_file"
lib_env::__set_client_globals
#
# Custom (optional) Dockerfile
#
[ -z "$global_custom_dockerfile" ] && lib_utils::die_fatal
[ -z "$global_repo_custom_dockerfile" ] && lib_utils::die_fatal
# Backup existing custom Dockerfile
if [ -f "$global_custom_dockerfile" ]; then
lib_utils::print_custom " \e[32m│\e[0m\n"
@@ -601,6 +328,8 @@ function lib_gen::__gen_profile()
function lib_gen::__gen_subprofile_shell()
{
[ -z "$global_shell_file" ] && lib_utils::die_fatal
local -r _gen_path="$1"
local -r _gen_conf_path="$2"

View File

@@ -26,7 +26,10 @@
# Docker impl
source "${DOCKER_FINANCE_CLIENT_REPO}/client/src/docker/lib/internal/lib_docker.bash" || exit 1
# Environment generation
# Runtime environment handler
source "${DOCKER_FINANCE_CLIENT_REPO}/client/src/docker/lib/internal/lib_env.bash" || exit 1
# Environment layout generator
source "${DOCKER_FINANCE_CLIENT_REPO}/client/src/docker/lib/internal/lib_gen.bash" || exit 1
# Plugins support
@@ -114,8 +117,8 @@ function lib_docker::docker()
declare -gxr global_usage="$global_basename ${global_platform}${global_arg_delim_1}${global_user}:${global_tag} $global_command"
lib_utils::print_debug "global_usage=${global_usage}"
# Setup remaining client/container globals
lib_gen::gen || return $?
# Setup remaining environment globals
lib_env::env || return $?
# Remaining "constructor" implementation
lib_docker::__docker || return $?
@@ -129,7 +132,7 @@ function lib_docker::docker()
function lib_docker::gen()
{
lib_gen::generate
lib_gen::gen
lib_utils::catch $?
}