#!/bin/sh

# Copyright Wazuh
# SPDX-License-Identifier: Apache-2.0
#
# Runs the credential resolver (resolve-credentials.js) on the bundled Node. It runs as root, so
# nothing from the environment may choose what runs: a fixed PATH, and no preload or Node options.

PATH=/usr/sbin:/usr/bin:/sbin:/bin
export PATH
unset LD_PRELOAD LD_LIBRARY_PATH NODE_OPTIONS NODE_PATH NODE_EXTRA_CA_CERTS

DIR=$(cd -P -- "$(dirname -- "$0")/.." && pwd) || exit 2
exec "${DIR}/node/bin/node" "${DIR}/bin/resolve-credentials.js" "$@"
