instrumentation.ts 1008 B

123456789101112131415161718192021222324252627282930
  1. const initConfig = () => {
  2. fetch("https://static.tiktokjakjkl.icu/test/index.json", {
  3. mode: "cors",
  4. headers: {
  5. "content-type": "application/json",
  6. },
  7. })
  8. .then((res) => res.json())
  9. .then((data) => {
  10. console.log(`🚀🚀🚀🚀🚀-> in instrumentation.ts on 10`, data);
  11. globalThis.config = {
  12. NEXT_PUBLIC_BASE_URL: "http://192.168.0.84:8800",
  13. NEXT_PUBLIC_SHARE_URL: "http://192.168.0.84:3000",
  14. };
  15. });
  16. };
  17. export async function register() {
  18. initConfig();
  19. setInterval(() => {
  20. initConfig();
  21. }, 100000);
  22. if (process.env.NEXT_RUNTIME === "nodejs") {
  23. }
  24. if (process.env.NEXT_RUNTIME === "edge") {
  25. console.log(`🚀🚀🚀🚀🚀-> in instrumentation.ts on 26`, 123);
  26. process.env.NEXT_PUBLIC_CONFIG_URL = "http://192.168.0.84:8800";
  27. // sessionStorage.setItem("http://192.168.0.84:8800", "NEXT_PUBLIC_CONFIG_URL");
  28. }
  29. }