- Add production setup scripts for automated deployment - Include monitoring setup and configuration validation - Add legacy setup scripts for various Linux distributions - Implement Bitwarden integration for secure credential management - Add development and production environment setup - Include comprehensive management tools and utilities - Add shell script library with common functions Provides complete automation for setup, deployment, and management of FetchML platform in development and production environments.
49 lines
1.3 KiB
Bash
49 lines
1.3 KiB
Bash
#!/usr/bin/env bash
|
||
set -euo pipefail
|
||
|
||
# Create a Bitwarden item for a FetchML API user.
|
||
#
|
||
# Usage:
|
||
# ./scripts/create_bitwarden_fetchml_item.sh <username> <api_key> <api_key_hash>
|
||
#
|
||
# Requirements:
|
||
# - Bitwarden CLI (bw) installed
|
||
# - You are logged in and unlocked (bw login; bw unlock)
|
||
# - jq installed
|
||
#
|
||
# This script does NOT run on the homelab server. Run it from your
|
||
# own machine where you manage Bitwarden.
|
||
|
||
if [[ $# -ne 3 ]]; then
|
||
echo "Usage: $0 <username> <api_key> <api_key_hash>" >&2
|
||
exit 1
|
||
fi
|
||
|
||
USER_NAME="$1"
|
||
API_KEY="$2"
|
||
API_KEY_HASH="$3"
|
||
|
||
ITEM_NAME="FetchML API $USER_NAME"
|
||
|
||
# Get base item template
|
||
TEMPLATE_JSON=$(bw get template item)
|
||
|
||
# Build item JSON with jq
|
||
ITEM_JSON=$(echo "$TEMPLATE_JSON" | jq \
|
||
--arg name "$ITEM_NAME" \
|
||
--arg username "$USER_NAME" \
|
||
--arg password "$API_KEY" \
|
||
--arg hash "$API_KEY_HASH" \
|
||
'.name = $name
|
||
| .login.username = $username
|
||
| .login.password = $password
|
||
| .notes = "FetchML API key for user " + $username
|
||
| .fields = [{"name":"api_key_hash","value":$hash,"type":1}]')
|
||
|
||
# Create item in Bitwarden
|
||
# If you ever want to edit instead, you can capture the ID from this call
|
||
# and use: bw edit item <id> <json>
|
||
|
||
echo "$ITEM_JSON" | bw encode | bw create item
|
||
|
||
echo "Created Bitwarden item: $ITEM_NAME"
|