port the make list functions and JWT, and expose the framework variables to hooks
lib/str.sh gains firstword, lastword, or, patsubst, filter, filter_out, addprefix, addsuffix and jwt: what the catalogue .mk files are written in. The make JWT macro split on the commas of its payload; this one does not. lib/context.sh registers COMPOSE_PROJECT_NAME, APP, DOCKER_NETWORK_* and the rest as lazy defaults, so a converted .mk keeps reading them as it did. Hooks also load a directory-level _stack.env and _stack.sh, for the .mk files of the catalogue that hold settings for several stacks at once.
This commit is contained in:
+4
-2
@@ -2,6 +2,8 @@
|
||||
# hooks: the per-stack settings that used to live in a .mk file.
|
||||
#
|
||||
# A stack may ship, next to its compose files:
|
||||
# _stack.env settings shared by every stack of the directory
|
||||
# _stack.sh the same, computed
|
||||
# <name>.env dotenv, for plain values
|
||||
# <name>.env.<env> the same, for one environment
|
||||
# <name>.sh shell, for values that have to be computed (fabio tags, JWTs)
|
||||
@@ -14,10 +16,10 @@
|
||||
# myos_stack_hooks DIR NAME load the hooks of one stack, most specific last
|
||||
myos_stack_hooks() {
|
||||
_hdir=$1; _hname=$2
|
||||
for _h in "$_hdir/$_hname.env" "$_hdir/$_hname.env.$ENV"; do
|
||||
for _h in "$_hdir/_stack.env" "$_hdir/$_hname.env" "$_hdir/$_hname.env.$ENV"; do
|
||||
[ -f "$_h" ] && myos_dotenv_load "$_h"
|
||||
done
|
||||
for _h in "$_hdir/$_hname.sh" "$_hdir/$_hname.$ENV.sh"; do
|
||||
for _h in "$_hdir/_stack.sh" "$_hdir/$_hname.sh" "$_hdir/$_hname.$ENV.sh"; do
|
||||
if [ -f "$_h" ]; then
|
||||
myos_debug "hook $_h"
|
||||
# shellcheck source=/dev/null
|
||||
|
||||
Reference in New Issue
Block a user