File size: 657 Bytes
c82f5b7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash
cat << 'INNER_EOF' > patch_logs_snippet.ts

  app.get("/logs", (req, res) => {
    try {
      if (fs.existsSync("/paperclip/bootstrap_logs.txt")) {
        const logs = fs.readFileSync("/paperclip/bootstrap_logs.txt", "utf-8");
        res.status(200).set("Content-Type", "text/plain").send(logs);
      } else {
        res.status(200).set("Content-Type", "text/plain").send("Logs not available yet. Please refresh in a few seconds.");
      }
    } catch (e) {
      res.status(500).set("Content-Type", "text/plain").send("Error: " + String(e));
    }
  });

INNER_EOF
sed -i '/app.use(httpLogger);/r patch_logs_snippet.ts' server/src/app.ts