Skip to content

Commit

Permalink
Fix development scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Scheel <[email protected]>
  • Loading branch information
cipherboy committed Oct 18, 2024
1 parent c82ad4a commit fc4e5a9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: MPL-2.0


TOOL=vault-plugin-auth-jwt
TOOL=openbao-plugin-auth-jwt
#
# This script builds the application from source for a platformx.
set -e
Expand Down
24 changes: 12 additions & 12 deletions scripts/local_dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
set -e

MNT_PATH="oidc"
PLUGIN_NAME="vault-plugin-auth-jwt"
PLUGIN_NAME="openbao-plugin-auth-jwt"
PLUGIN_CATALOG_NAME="oidc"

#
# Helper script for local development. Automatically builds and registers the
# plugin. Requires `vault` is installed and available on $PATH.
# plugin. Requires `bao` is installed and available on $PATH.
#

# Get the right dir
Expand All @@ -25,46 +25,46 @@ mkdir -p "$SCRATCH/plugins"

echo "--> Vault server"
echo " Writing config"
tee "$SCRATCH/vault.hcl" > /dev/null <<EOF
tee "$SCRATCH/config.hcl" > /dev/null <<EOF
plugin_directory = "$SCRATCH/plugins"
EOF

echo " Envvars"
export VAULT_DEV_ROOT_TOKEN_ID="root"
export VAULT_ADDR="http://127.0.0.1:8200"
export BAO_DEV_ROOT_TOKEN_ID="root"
export BAO_ADDR="http://127.0.0.1:8200"

echo " Starting"
vault server \
bao server \
-dev \
-log-level="debug" \
-config="$SCRATCH/vault.hcl" \
-config="$SCRATCH/config.hcl" \
-dev-ha -dev-transactional -dev-root-token-id=root \
&
sleep 2
VAULT_PID=$!
BAO_PID=$!

function cleanup {
echo ""
echo "==> Cleaning up"
kill -INT "$VAULT_PID"
kill -INT "$BAO_PID"
rm -rf "$SCRATCH"
}
trap cleanup EXIT

echo " Authing"
vault login root &>/dev/null
bao login root &>/dev/null

echo "--> Building"
go build -o "$SCRATCH/plugins/$PLUGIN_NAME" "./cmd/$PLUGIN_NAME"
SHASUM=$(shasum -a 256 "$SCRATCH/plugins/$PLUGIN_NAME" | cut -d " " -f1)

echo " Registering plugin"
vault write sys/plugins/catalog/$PLUGIN_CATALOG_NAME \
bao write sys/plugins/catalog/$PLUGIN_CATALOG_NAME \
sha_256="$SHASUM" \
command="$PLUGIN_NAME"

echo " Mounting plugin"
vault auth enable -path=$MNT_PATH -plugin-name=$PLUGIN_CATALOG_NAME -listing-visibility=unauth plugin
bao auth enable -path=$MNT_PATH -plugin-name=$PLUGIN_CATALOG_NAME -listing-visibility=unauth plugin

if [ -e scripts/custom.sh ]
then
Expand Down

0 comments on commit fc4e5a9

Please sign in to comment.