v0.2.12 - Command line variables added
This commit is contained in:
@@ -35,20 +35,29 @@ if [ "$HELP" = true ]; then
|
||||
echo " --preserve-config, -p Keep existing configuration file (don't regenerate)"
|
||||
echo " --help, -h Show this help message"
|
||||
echo ""
|
||||
echo "Development Setup:"
|
||||
echo " Uses local config directory: ./dev-config/"
|
||||
echo " This avoids conflicts with production instances using ~/.config/c-relay/"
|
||||
echo ""
|
||||
echo "Default behavior: Automatically regenerates configuration file on each build"
|
||||
echo " for development purposes"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Handle configuration file and database regeneration
|
||||
CONFIG_FILE="$HOME/.config/c-relay/c_relay_config_event.json"
|
||||
# Use local development config directory to avoid conflicts with production
|
||||
DEV_CONFIG_DIR="./dev-config"
|
||||
CONFIG_FILE="$DEV_CONFIG_DIR/c_relay_config_event.json"
|
||||
DB_FILE="./db/c_nostr_relay.db"
|
||||
|
||||
# Create development config directory if it doesn't exist
|
||||
mkdir -p "$DEV_CONFIG_DIR"
|
||||
|
||||
if [ "$PRESERVE_CONFIG" = false ]; then
|
||||
if [ -f "$CONFIG_FILE" ]; then
|
||||
echo "Removing old configuration file to trigger regeneration..."
|
||||
echo "Removing old development configuration file to trigger regeneration..."
|
||||
rm -f "$CONFIG_FILE"
|
||||
echo "✓ Configuration file removed - will be regenerated with new keys"
|
||||
echo "✓ Development configuration file removed - will be regenerated with new keys"
|
||||
fi
|
||||
if [ -f "$DB_FILE" ]; then
|
||||
echo "Removing old database to trigger fresh key generation..."
|
||||
@@ -56,9 +65,9 @@ if [ "$PRESERVE_CONFIG" = false ]; then
|
||||
echo "✓ Database removed - will be recreated with embedded schema and new keys"
|
||||
fi
|
||||
elif [ "$PRESERVE_CONFIG" = true ]; then
|
||||
echo "Preserving existing configuration and database as requested"
|
||||
echo "Preserving existing development configuration and database as requested"
|
||||
else
|
||||
echo "No existing configuration or database found - will generate fresh setup"
|
||||
echo "No existing development configuration or database found - will generate fresh setup"
|
||||
fi
|
||||
|
||||
# Build the project first
|
||||
@@ -124,8 +133,8 @@ echo "Database will be initialized automatically on startup if needed"
|
||||
echo "Starting relay server..."
|
||||
echo "Debug: Current processes: $(ps aux | grep 'c_relay_' | grep -v grep || echo 'None')"
|
||||
|
||||
# Start relay in background and capture its PID
|
||||
$BINARY_PATH > relay.log 2>&1 &
|
||||
# Start relay in background and capture its PID with development config directory
|
||||
$BINARY_PATH --config-dir "$DEV_CONFIG_DIR" > relay.log 2>&1 &
|
||||
RELAY_PID=$!
|
||||
|
||||
echo "Started with PID: $RELAY_PID"
|
||||
@@ -158,10 +167,11 @@ if ps -p "$RELAY_PID" >/dev/null 2>&1; then
|
||||
fi
|
||||
|
||||
echo "=== Relay server running in background ==="
|
||||
echo "Development config: $DEV_CONFIG_DIR/"
|
||||
echo "To kill relay: pkill -f 'c_relay_'"
|
||||
echo "To check status: ps aux | grep c_relay_"
|
||||
echo "To view logs: tail -f relay.log"
|
||||
echo "Binary: $BINARY_PATH"
|
||||
echo "Binary: $BINARY_PATH --config-dir $DEV_CONFIG_DIR"
|
||||
echo "Ready for Nostr client connections!"
|
||||
else
|
||||
echo "ERROR: Relay failed to start"
|
||||
|
||||
Reference in New Issue
Block a user