diff --git a/deploy/env.sh b/deploy/env.sh index 792e93e76..8c9ddd6b9 100644 --- a/deploy/env.sh +++ b/deploy/env.sh @@ -9,6 +9,7 @@ envs=( "SERVER_API_URL" "EDITOR_SOCKET_URL" "HOMEWORK_URI" + "ETHERPAD_URL" "ENABLE_LTI" ) diff --git a/src/config.js b/src/config.js index 70b139d77..c80ac51a8 100644 --- a/src/config.js +++ b/src/config.js @@ -11,7 +11,12 @@ const config = { EDITOR_API_URL: window.EDITOR_API_URL || process.env.EDITOR_API_URL || "http://localhost:4001", SERVER_API_URL: window.SERVER_API_URL || process.env.SERVER_API_URL || "http://localhost:3030", EDITOR_SOCKET_URL: window.EDITOR_SOCKET_URL || process.env.EDITOR_SOCKET_URL || "ws://localhost:4001", + ETHERPAD_URL: window.ETHERPAD_URL || process.env.ETHERPAD_URL || "https://etherpad.schul-cloud.org/p/", + HOMEWORK_URI: window.HOMEWORK_URI || process.env.HOMEWORK_URI || "/homework", + NEXBOARD_BOARDS_URI: window.NEXBOARD_BOARD_URI || process.env.NEXBOARD_BOARD_URI || '/nexboard/boards', + NEXBOARD_PROJECTS_URI: window.NEXBOARD_PROJECTS_URI || process.env.NEXBOARD_PROJECTS_URI || '/nexboard/projects', + ENABLE_LTI: window.ENABLE_LTI || process.env.ENABLE_LTI || false, breakpoints: { @@ -22,5 +27,5 @@ const config = { }; // eslint-disable-next-line no-console -console.info("config", config); +console.info("config", JSON.stringify(config)); export default config; diff --git a/src/index.html b/src/index.html index 64c9dc268..e844cc09a 100644 --- a/src/index.html +++ b/src/index.html @@ -18,7 +18,7 @@ // We need the RAW file from the root dir // https://github.com/parcel-bundler/parcel/issues/1087#issuecomment-576810737 const script = document.createElement("script"); - script.setAttribute("src", "env.js"); + script.setAttribute("src", "/env.js"); script.setAttribute("type", "text/javascript"); document.head.prepend(script); diff --git a/src/plugins/etherpad/Etherpad.jsx b/src/plugins/etherpad/Etherpad.jsx index 486d80b3d..c24b29344 100644 --- a/src/plugins/etherpad/Etherpad.jsx +++ b/src/plugins/etherpad/Etherpad.jsx @@ -1,29 +1,20 @@ -import React, { useState, useEffect, useContext } from "react" +import React, { useEffect } from "react" import shortid from "shortid" -import LessonContext from "~/Contexts/Lesson.context" +import config from "~/config" -import Input from "~/components/Input" -import Flex from "~/components/Flex" - -import { createBoard } from "./utils" - -const Etherpad = ({ focused, state }) => { +const Etherpad = ({ state }) => { useEffect(() => { if (state._id.value) return state._id.set(shortid.generate()) }, []) - const { store, dispatch } = useContext(LessonContext) + const url = config.ETHERPAD_URL; - let etherpadFrame if (state._id.get()) { return (