|
@ -36,6 +36,39 @@ else |
|
|
modules="base,${modules}" |
|
|
modules="base,${modules}" |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
cmd_args=() |
|
|
|
|
|
|
|
|
|
|
|
## dbfilter management |
|
|
|
|
|
service_def=$(get_compose_service_def "$SERVICE_NAME") || return 1 |
|
|
|
|
|
|
|
|
|
|
|
dbfilter=$(e "$service_def" | yq e -r=false '.options.dbfilter') || true |
|
|
|
|
|
if [ -n "$dbfilter" ]; then |
|
|
|
|
|
type=$(e "$dbfilter" | yq e "type") |
|
|
|
|
|
case "${type:2}" in |
|
|
|
|
|
str) |
|
|
|
|
|
dbfilter=$(e "$dbfilter" | yq e -o=json '.') |
|
|
|
|
|
cmd_args+=("--db-filter=${dbfilter}") |
|
|
|
|
|
;; |
|
|
|
|
|
map) |
|
|
|
|
|
python_expr="[" |
|
|
|
|
|
while read-0 key val; do |
|
|
|
|
|
[[ "$key" == "null" ]] && key="None" |
|
|
|
|
|
python_expr+="(${key//\$/\$\$}, ${val//\$/\$\$})," |
|
|
|
|
|
done < <(e "$dbfilter" | yq -o=json -0 'to_entries | .[] | [.key, .value] | .[]') |
|
|
|
|
|
python_expr+="]" |
|
|
|
|
|
cmd_args+=("--db-filter=${python_expr}") |
|
|
|
|
|
;; |
|
|
|
|
|
null) |
|
|
|
|
|
: |
|
|
|
|
|
;; |
|
|
|
|
|
*) |
|
|
|
|
|
err "Invalid value for ${WHITE}dbfilter${NORMAL}: ${dbfilter}" >&2 |
|
|
|
|
|
echo " It should be a string or a key/value mapping" >&2 |
|
|
|
|
|
exit 1 |
|
|
|
|
|
;; |
|
|
|
|
|
esac |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## config file |
|
|
## config file |
|
|
conf=$(options-get conf 2>/dev/null) || true |
|
|
conf=$(options-get conf 2>/dev/null) || true |
|
@ -65,4 +98,10 @@ $SERVICE_NAME: |
|
|
command: |
|
|
command: |
|
|
- \"--workers=${workers}\" |
|
|
- \"--workers=${workers}\" |
|
|
- \"-i ${modules}\" |
|
|
- \"-i ${modules}\" |
|
|
|
|
|
$( |
|
|
|
|
|
for arg in "${cmd_args[@]}"; do |
|
|
|
|
|
echo " - |" |
|
|
|
|
|
e "$arg" | prefix " " |
|
|
|
|
|
done |
|
|
|
|
|
) |
|
|
" |
|
|
" |