From dc467b05efc1b1bde37856f3f2e0abe991520057 Mon Sep 17 00:00:00 2001
From: Robert Long <robert@robertlong.me>
Date: Tue, 24 Apr 2018 11:29:01 -0700
Subject: [PATCH] Make asset server configurable

---
 scripts/default.env               |  1 +
 src/assets/avatars/avatars.js     | 20 ++++++++++----------
 src/hub.html                      | 20 ++++++++++----------
 src/hub.js                        |  8 ++++----
 src/react-components/home-root.js | 10 +++++-----
 5 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/scripts/default.env b/scripts/default.env
index b5dbe2c7c..e027cf715 100644
--- a/scripts/default.env
+++ b/scripts/default.env
@@ -4,3 +4,4 @@ ORIGIN_TRIAL_TOKEN="ArEZ0vY0uMo3pj+oY8Up4u4Hy8QolJwKxG4/2WRhSPnTZRrviiGhzP6/y72n
 ORIGIN_TRIAL_EXPIRES="2018-05-15"
 JANUS_SERVER="wss://prod-janus.reticulum.io"
 DEV_RETICULUM_SERVER="dev.reticulum.io"
+ASSET_SERVER="https://asset-bundles-prod.reticulum.io"
diff --git a/src/assets/avatars/avatars.js b/src/assets/avatars/avatars.js
index 76533865e..f66f7d28e 100644
--- a/src/assets/avatars/avatars.js
+++ b/src/assets/avatars/avatars.js
@@ -1,42 +1,42 @@
 export const avatars = [
   {
     id: "botdefault",
-    model: "https://asset-bundles-prod.reticulum.io/bots/BotDefault_Avatar-9f71f8ff22.gltf"
+    model: process.env.ASSET_SERVER + "/bots/BotDefault_Avatar-9f71f8ff22.gltf"
   },
   {
     id: "botbobo",
-    model: "https://asset-bundles-prod.reticulum.io/bots/BotBobo_Avatar-f9740a010b.gltf"
+    model: process.env.ASSET_SERVER + "/bots/BotBobo_Avatar-f9740a010b.gltf"
   },
   {
     id: "botdom",
-    model: "https://asset-bundles-prod.reticulum.io/bots/BotDom_Avatar-6aa1b5d781.gltf"
+    model: process.env.ASSET_SERVER + "/bots/BotDom_Avatar-6aa1b5d781.gltf"
   },
   {
     id: "botgreg",
-    model: "https://asset-bundles-prod.reticulum.io/bots/BotGreg_Avatar-98d39797bb.gltf"
+    model: process.env.ASSET_SERVER + "/bots/BotGreg_Avatar-98d39797bb.gltf"
   },
   {
     id: "botguest",
-    model: "https://asset-bundles-prod.reticulum.io/bots/BotGuest_Avatar-78cd857332.gltf"
+    model: process.env.ASSET_SERVER + "/bots/BotGuest_Avatar-78cd857332.gltf"
   },
   {
     id: "botjim",
-    model: "https://asset-bundles-prod.reticulum.io/bots/BotJim_Avatar-d28005a687.gltf"
+    model: process.env.ASSET_SERVER + "/bots/BotJim_Avatar-d28005a687.gltf"
   },
   {
     id: "botkev",
-    model: "https://asset-bundles-prod.reticulum.io/bots/BotKev_Avatar-a95787bb51.gltf"
+    model: process.env.ASSET_SERVER + "/bots/BotKev_Avatar-a95787bb51.gltf"
   },
   {
     id: "botpinky",
-    model: "https://asset-bundles-prod.reticulum.io/bots/BotPinky_Avatar-b0b93f8675.gltf"
+    model: process.env.ASSET_SERVER + "/bots/BotPinky_Avatar-b0b93f8675.gltf"
   },
   {
     id: "botrobert",
-    model: "https://asset-bundles-prod.reticulum.io/bots/BotRobert_Avatar-e9554880f3.gltf"
+    model: process.env.ASSET_SERVER + "/bots/BotRobert_Avatar-e9554880f3.gltf"
   },
   {
     id: "botwoody",
-    model: "https://asset-bundles-prod.reticulum.io/bots/BotWoody_Avatar-0140485a23.gltf"
+    model: process.env.ASSET_SERVER + "/bots/BotWoody_Avatar-0140485a23.gltf"
   }
 ];
diff --git a/src/hub.html b/src/hub.html
index 6632c5c92..bbb1185a8 100644
--- a/src/hub.html
+++ b/src/hub.html
@@ -49,16 +49,16 @@
             <img id="freeze-on"  src="./assets/hud/freeze_on.png" >
             <img id="freeze-on-hover"  src="./assets/hud/freeze_on-hover.png" >
 
-            <a-asset-item id="botdefault" response-type="arraybuffer" src="https://asset-bundles-prod.reticulum.io/bots/BotDefault_Avatar-9f71f8ff22.gltf"></a-asset-item>
-            <a-asset-item id="botbobo" response-type="arraybuffer" src="https://asset-bundles-prod.reticulum.io/bots/BotBobo_Avatar-f9740a010b.gltf"></a-asset-item>
-            <a-asset-item id="botdom" response-type="arraybuffer" src="https://asset-bundles-prod.reticulum.io/bots/BotDom_Avatar-6aa1b5d781.gltf"></a-asset-item>
-            <a-asset-item id="botgreg" response-type="arraybuffer" src="https://asset-bundles-prod.reticulum.io/bots/BotGreg_Avatar-98d39797bb.gltf"></a-asset-item>
-            <a-asset-item id="botguest" response-type="arraybuffer" src="https://asset-bundles-prod.reticulum.io/bots/BotGuest_Avatar-78cd857332.gltf"></a-asset-item>
-            <a-asset-item id="botjim" response-type="arraybuffer" src="https://asset-bundles-prod.reticulum.io/bots/BotJim_Avatar-d28005a687.gltf"></a-asset-item>
-            <a-asset-item id="botkev" response-type="arraybuffer" src="https://asset-bundles-prod.reticulum.io/bots/BotKev_Avatar-a95787bb51.gltf"></a-asset-item>
-            <a-asset-item id="botpinky" response-type="arraybuffer" src="https://asset-bundles-prod.reticulum.io/bots/BotPinky_Avatar-b0b93f8675.gltf"></a-asset-item>
-            <a-asset-item id="botrobert" response-type="arraybuffer" src="https://asset-bundles-prod.reticulum.io/bots/BotRobert_Avatar-e9554880f3.gltf"></a-asset-item>
-            <a-asset-item id="botwoody" response-type="arraybuffer" src="https://asset-bundles-prod.reticulum.io/bots/BotWoody_Avatar-0140485a23.gltf"></a-asset-item>
+            <a-asset-item id="botdefault" response-type="arraybuffer" src="<%= process.env.ASSET_SERVER %>/bots/BotDefault_Avatar-9f71f8ff22.gltf"></a-asset-item>
+            <a-asset-item id="botbobo" response-type="arraybuffer" src="<%= process.env.ASSET_SERVER %>/bots/BotBobo_Avatar-f9740a010b.gltf"></a-asset-item>
+            <a-asset-item id="botdom" response-type="arraybuffer" src="<%= process.env.ASSET_SERVER %>/bots/BotDom_Avatar-6aa1b5d781.gltf"></a-asset-item>
+            <a-asset-item id="botgreg" response-type="arraybuffer" src="<%= process.env.ASSET_SERVER %>/bots/BotGreg_Avatar-98d39797bb.gltf"></a-asset-item>
+            <a-asset-item id="botguest" response-type="arraybuffer" src="<%= process.env.ASSET_SERVER %>/bots/BotGuest_Avatar-78cd857332.gltf"></a-asset-item>
+            <a-asset-item id="botjim" response-type="arraybuffer" src="<%= process.env.ASSET_SERVER %>/bots/BotJim_Avatar-d28005a687.gltf"></a-asset-item>
+            <a-asset-item id="botkev" response-type="arraybuffer" src="<%= process.env.ASSET_SERVER %>/bots/BotKev_Avatar-a95787bb51.gltf"></a-asset-item>
+            <a-asset-item id="botpinky" response-type="arraybuffer" src="<%= process.env.ASSET_SERVER %>/bots/BotPinky_Avatar-b0b93f8675.gltf"></a-asset-item>
+            <a-asset-item id="botrobert" response-type="arraybuffer" src="<%= process.env.ASSET_SERVER %>/bots/BotRobert_Avatar-e9554880f3.gltf"></a-asset-item>
+            <a-asset-item id="botwoody" response-type="arraybuffer" src="<%= process.env.ASSET_SERVER %>/bots/BotWoody_Avatar-0140485a23.gltf"></a-asset-item>
 
             <a-asset-item id="watch-model" response-type="arraybuffer" src="./assets/hud/watch.glb"></a-asset-item>
             <a-asset-item id="interactable-duck" response-type="arraybuffer" src="./assets/interactables/duck/DuckyMesh.glb"></a-asset-item>
diff --git a/src/hub.js b/src/hub.js
index f9cd5144a..a25eebbaf 100644
--- a/src/hub.js
+++ b/src/hub.js
@@ -330,10 +330,10 @@ const onReady = async () => {
     // If ?room is set, this is `yarn start`, so just use a default environment and query string room.
     remountUI({ janusRoomId: qs.room && !isNaN(parseInt(qs.room)) ? parseInt(qs.room) : 1 });
     initialEnvironmentEl.setAttribute("gltf-bundle", {
-      src: "https://asset-bundles-prod.reticulum.io/rooms/meetingroom/MeetingRoom.bundle.json"
-      // src: "https://asset-bundles-prod.reticulum.io/rooms/theater/TheaterMeshes.bundle.json"
-      // src: "https://asset-bundles-prod.reticulum.io/rooms/atrium/AtriumMeshes.bundle.json"
-      // src: "https://asset-bundles-prod.reticulum.io/rooms/courtyard/CourtyardMeshes.bundle.json"
+      src: process.env.ASSET_SERVER + "/rooms/meetingroom/MeetingRoom.bundle.json"
+      // src: process.env.ASSET_SERVER + "/rooms/theater/TheaterMeshes.bundle.json"
+      // src: process.env.ASSET_SERVER + "/rooms/atrium/AtriumMeshes.bundle.json"
+      // src: process.env.ASSET_SERVER + "/rooms/courtyard/CourtyardMeshes.bundle.json"
     });
     return;
   }
diff --git a/src/react-components/home-root.js b/src/react-components/home-root.js
index f930eaea7..149797cc3 100644
--- a/src/react-components/home-root.js
+++ b/src/react-components/home-root.js
@@ -18,11 +18,11 @@ addLocaleData([...en]);
 const messages = localeData[lang] || localeData.en;
 
 const ENVIRONMENT_URLS = [
-  "https://asset-bundles-prod.reticulum.io/rooms/meetingroom/MeetingRoom.bundle.json",
-  "https://asset-bundles-prod.reticulum.io/rooms/theater/Theater.bundle.json",
-  "https://asset-bundles-prod.reticulum.io/rooms/atrium/Atrium.bundle.json",
-  "https://asset-bundles-prod.reticulum.io/rooms/courtyard/Courtyard.bundle.json",
-  "https://asset-bundles-prod.reticulum.io/rooms/MedievalFantasyBook/MedievalFantasyBook.bundle.json"
+  process.env.ASSET_SERVER + "/rooms/meetingroom/MeetingRoom.bundle.json",
+  process.env.ASSET_SERVER + "/rooms/theater/Theater.bundle.json",
+  process.env.ASSET_SERVER + "/rooms/atrium/Atrium.bundle.json",
+  process.env.ASSET_SERVER + "/rooms/courtyard/Courtyard.bundle.json",
+  process.env.ASSET_SERVER + "/rooms/MedievalFantasyBook/MedievalFantasyBook.bundle.json"
 ];
 
 class HomeRoot extends Component {
-- 
GitLab