mirror of
https://github.com/mulgadc/spinifex.git
synced 2026-10-19 19:01:42 +00:00
3c2f57101f
* fix: remove predastore filesystem backend references * fix: remove unused import * chore: bump predastore version * fix: create test buckets explicitly
28 lines
789 B
Bash
Executable File
28 lines
789 B
Bash
Executable File
#!/bin/sh
|
|
# Helper script for spinifex-predastore.service
|
|
# Detects host, port, backend, and node-id from spinifex.toml
|
|
# then execs spx. Falls back to single-node defaults if no config found.
|
|
|
|
CONF=/etc/spinifex/spinifex.toml
|
|
BIND="0.0.0.0:8443"
|
|
NODE_ID="0"
|
|
|
|
if [ -f "$CONF" ]; then
|
|
H=$(awk -F'"' '/\[nodes\..*\.predastore\]/{f=1} f&&/^host/{print $2;exit}' "$CONF")
|
|
if [ -n "$H" ]; then
|
|
BIND="$H"
|
|
BACKEND="distributed"
|
|
fi
|
|
|
|
N=$(awk -F'= *' '/node_id/{gsub(/ /,"",$2);print $2;exit}' "$CONF")
|
|
if [ -n "$N" ] && [ "$N" != "0" ]; then
|
|
NODE_ID="$N"
|
|
fi
|
|
fi
|
|
|
|
export SPINIFEX_PREDASTORE_HOST="${BIND%%:*}"
|
|
export SPINIFEX_PREDASTORE_PORT="${BIND##*:}"
|
|
export SPINIFEX_PREDASTORE_NODE_ID="$NODE_ID"
|
|
|
|
exec /usr/local/bin/spx service predastore start
|