v0.2.11 - Picky shit
This commit is contained in:
@@ -32,7 +32,7 @@ if [ "$HELP" = true ]; then
|
||||
echo "Usage: $0 [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --preserve-config Keep existing configuration file (don't regenerate)"
|
||||
echo " --preserve-config, -p Keep existing configuration file (don't regenerate)"
|
||||
echo " --help, -h Show this help message"
|
||||
echo ""
|
||||
echo "Default behavior: Automatically regenerates configuration file on each build"
|
||||
@@ -40,16 +40,25 @@ if [ "$HELP" = true ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Handle configuration file regeneration
|
||||
# Handle configuration file and database regeneration
|
||||
CONFIG_FILE="$HOME/.config/c-relay/c_relay_config_event.json"
|
||||
if [ "$PRESERVE_CONFIG" = false ] && [ -f "$CONFIG_FILE" ]; then
|
||||
echo "Removing old configuration file to trigger regeneration..."
|
||||
rm -f "$CONFIG_FILE"
|
||||
echo "✓ Configuration file removed - will be regenerated with latest database values"
|
||||
elif [ "$PRESERVE_CONFIG" = true ] && [ -f "$CONFIG_FILE" ]; then
|
||||
echo "Preserving existing configuration file as requested"
|
||||
elif [ ! -f "$CONFIG_FILE" ]; then
|
||||
echo "No existing configuration file found - will generate new one"
|
||||
DB_FILE="./db/c_nostr_relay.db"
|
||||
|
||||
if [ "$PRESERVE_CONFIG" = false ]; then
|
||||
if [ -f "$CONFIG_FILE" ]; then
|
||||
echo "Removing old configuration file to trigger regeneration..."
|
||||
rm -f "$CONFIG_FILE"
|
||||
echo "✓ Configuration file removed - will be regenerated with new keys"
|
||||
fi
|
||||
if [ -f "$DB_FILE" ]; then
|
||||
echo "Removing old database to trigger fresh key generation..."
|
||||
rm -f "$DB_FILE"* # Remove db file and any WAL/SHM files
|
||||
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"
|
||||
else
|
||||
echo "No existing configuration or database found - will generate fresh setup"
|
||||
fi
|
||||
|
||||
# Build the project first
|
||||
@@ -107,11 +116,9 @@ fi
|
||||
# Clean up PID file
|
||||
rm -f relay.pid
|
||||
|
||||
# Initialize database if needed
|
||||
if [ ! -f "./db/c_nostr_relay.db" ]; then
|
||||
echo "Initializing database..."
|
||||
./db/init.sh --force >/dev/null 2>&1
|
||||
fi
|
||||
# Database initialization is now handled automatically by the relay
|
||||
# when it starts up with embedded schema
|
||||
echo "Database will be initialized automatically on startup if needed"
|
||||
|
||||
# Start relay in background with output redirection
|
||||
echo "Starting relay server..."
|
||||
@@ -137,16 +144,16 @@ if ps -p "$RELAY_PID" >/dev/null 2>&1; then
|
||||
# Save PID for debugging
|
||||
echo $RELAY_PID > relay.pid
|
||||
|
||||
# Check if a new private key was generated and display it
|
||||
# Check if new keys were generated and display them
|
||||
sleep 1 # Give relay time to write initial logs
|
||||
if grep -q "GENERATED RELAY ADMIN PRIVATE KEY" relay.log 2>/dev/null; then
|
||||
echo "=== IMPORTANT: NEW ADMIN PRIVATE KEY GENERATED ==="
|
||||
if grep -q "GENERATED RELAY KEYPAIRS" relay.log 2>/dev/null; then
|
||||
echo "=== IMPORTANT: NEW KEYPAIRS GENERATED ==="
|
||||
echo ""
|
||||
# Extract and display the private key section from the log
|
||||
grep -A 8 -B 2 "GENERATED RELAY ADMIN PRIVATE KEY" relay.log | head -n 12
|
||||
# Extract and display the keypairs section from the log
|
||||
grep -A 12 -B 2 "GENERATED RELAY KEYPAIRS" relay.log | head -n 16
|
||||
echo ""
|
||||
echo "⚠️ SAVE THIS PRIVATE KEY SECURELY - IT CONTROLS YOUR RELAY!"
|
||||
echo "⚠️ This key is also logged in relay.log for reference"
|
||||
echo "⚠️ SAVE THESE PRIVATE KEYS SECURELY - THEY CONTROL YOUR RELAY!"
|
||||
echo "⚠️ These keys are also logged in relay.log for reference"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user