@learnpack/learnpack 5.0.340 → 5.0.341

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -733,7 +733,8 @@ class ServeCommand extends SessionCommand_1.default {
733
733
  credentials,
734
734
  });
735
735
  const bucket = bucketStorage.bucket(process.env.GCP_BUCKET_NAME || "learnpack-packages");
736
- const host = process.env.HOST;
736
+ const rawHost = process.env.HOST || "";
737
+ const host = rawHost.trim().split(/\s+#/)[0].trim();
737
738
  if (!host) {
738
739
  console.log("ERROR: HOST is not set, please set the HOST environment variable");
739
740
  process.exit(1);
@@ -742,13 +743,24 @@ class ServeCommand extends SessionCommand_1.default {
742
743
  console.log("INFO: HOST is set to", host);
743
744
  }
744
745
  // Initialize Redis (official client)
745
- const redisUrl = process.env.REDIS_URL || "redis://localhost:6379";
746
+ let redisUrl = (process.env.REDIS_URL || "redis://localhost:6379").trim();
747
+ // Strip surrounding quotes if present (e.g. from .env)
748
+ if ((redisUrl.startsWith('"') && redisUrl.endsWith('"')) ||
749
+ (redisUrl.startsWith("'") && redisUrl.endsWith("'"))) {
750
+ redisUrl = redisUrl.slice(1, -1);
751
+ }
752
+ const isPlaceholderRedisUrl = redisUrl.includes("your_production_password") ||
753
+ redisUrl.includes("your-redis-instance.cloud");
746
754
  if (process.env.NODE_ENV === "production" &&
747
- redisUrl === "redis://localhost:6379") {
755
+ (redisUrl === "redis://localhost:6379" || isPlaceholderRedisUrl)) {
748
756
  console.error("❌ REDIS_URL not configured for production environment!");
749
757
  console.warn("⚠️ History features will be unavailable");
750
758
  this.redis = null;
751
759
  }
760
+ else if (isPlaceholderRedisUrl) {
761
+ console.warn("⚠️ REDIS_URL looks like a placeholder; skipping Redis. History features (undo/redo) will be unavailable");
762
+ this.redis = null;
763
+ }
752
764
  else {
753
765
  try {
754
766
  const useTLS = redisUrl.startsWith("rediss://");
@@ -797,7 +809,8 @@ class ServeCommand extends SessionCommand_1.default {
797
809
  const app = express();
798
810
  const server = http.createServer(app);
799
811
  (0, creatorSocket_1.initSocketIO)(server);
800
- const PORT = process.env.PORT || 3000;
812
+ const rawPort = process.env.PORT || "3000";
813
+ const PORT = parseInt(String(rawPort).trim().split(/\s+#/)[0].trim(), 10) || 3000;
801
814
  const distPath = path.resolve(__dirname, "../creatorDist");
802
815
  // Servir archivos estáticos
803
816
  // app.use(express.static(distPath))