feat(bin): add --version and --config parameters

--config is to prevent Oxicloud loading any other .env, usefully when you want to test with different environements
This commit is contained in:
Edouard Vanbelle
2026-06-11 09:15:09 +02:00
parent 140cbb440e
commit ce69bbe151
3 changed files with 70 additions and 5 deletions
+7 -2
View File
@@ -74,13 +74,18 @@ wipe_storage "$OXICLOUD_STORAGE_PATH"
BUILD_TARGET="${BUILD_TARGET:-debug}"
OXICLOUD_BIN="$REPO_ROOT/target/$BUILD_TARGET/oxicloud"
# `--config` pins the env file the binary reads AND suppresses the default
# `.env` probe in main.rs, so a developer's repo-root `.env` can never leak
# into a test run. Bash also sourced the same file above, so anything the
# test harness itself reads via $OXICLOUD_* stays available; dotenvy won't
# override those already-exported values.
if [[ -x "$OXICLOUD_BIN" ]]; then
log "Starting pre-built OxiCloud server ($BUILD_TARGET) on port $SERVER_PORT..."
"$OXICLOUD_BIN" &
"$OXICLOUD_BIN" --config "$COMMON/server.env" &
else
log "Building and starting OxiCloud server on port $SERVER_PORT..."
cd "$REPO_ROOT"
cargo run &
cargo run -- --config "$COMMON/server.env" &
fi
SERVER_PID=$!
log "Waiting for server at $base_url..."