#!/bin/bash cd "$(dirname "$0")" export WATERMARK_API_PORT=${WATERMARK_API_PORT:-3022} export WATERMARK_API_HOST=${WATERMARK_API_HOST:-0.0.0.0} export ANCHOR_API_URL=${ANCHOR_API_URL:-http://localhost:3010} export BLOCKCHAIN_API_URL=${BLOCKCHAIN_API_URL:-http://localhost:3020} export LOG_LEVEL=${LOG_LEVEL:-info} export NODE_ENV=${NODE_ENV:-production} # Charger les variables d'environnement depuis .env si présent if [ -f .env ]; then export $(cat .env | grep -v '^#' | xargs) fi # Vérifier que Node.js est installé if ! command -v node &> /dev/null; then echo "❌ Node.js n'est pas installé" exit 1 fi # Vérifier la version de Node.js NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1) if [ "$NODE_VERSION" -lt 18 ]; then echo "❌ Node.js version 18 ou supérieure est requise" exit 1 fi # Installer les dépendances si nécessaire if [ ! -d "node_modules" ]; then echo "📦 Installation des dépendances..." npm install fi echo "🚀 Démarrage de l'API filigrane sur le port $WATERMARK_API_PORT..." node src/server.js