| 123456789101112131415161718192021222324252627282930 |
- #!/bin/bash
- # Example:
- # ./start.sh --date=2021-12-05
- PORT="9000"
- PROXY_URL="http://localhost:$PORT/"
- BIN_FILE="./nptm"
- CURRENT_REGISTRY=$(npm config get registry)
- echo "Current registry: $CURRENT_REGISTRY"
- cleanup() {
- echo ""
- echo "----------------------------------------"
- echo "Shutdown..."
- echo "Restore npm configuration..."
- npm config set registry "$CURRENT_REGISTRY"
- echo "Registry restored: $(npm config get registry)"
- }
- trap cleanup EXIT
- echo "Switching npm to port $PORT ($PROXY_URL)"
- npm config set registry "$PROXY_URL"
- echo "Starting Time Machine on port $PORT..."
- echo "----------------------------------------"
- "$BIN_FILE" --port="$PORT" "$@"
|