diff --git a/make.sh b/make.sh index 99b5a78..31338b6 100755 --- a/make.sh +++ b/make.sh @@ -1,18 +1,2 @@ #!/bin/bash -scriptPath=$(dirname -- "${0}") -domainPath="${scriptPath}/../../data/domain" - -domain="${DOMAIN}" - -if [ -z "${domain}" ] && [ -f "${domainPath}" ]; then - domain=$(cat "${domainPath}") -fi - -if [ -z "${domain}" ]; then - echo -e "\033[0;41mDOMAIN is not set, and ${domainPath} does not exist!\033[0m" - exit 1 -fi - -NEXT_PUBLIC_DOMAIN="${domain}" npm run export - -echo "Exported with domain: '${domain}'" +npm run export diff --git a/src/constants.js b/src/constants.js index 8bb2427..0f42fdf 100644 --- a/src/constants.js +++ b/src/constants.js @@ -1,20 +1,9 @@ // eslint-disable-next-line no-undef const useLocalhost = process && process.env.NODE_ENV === 'development' -// eslint-disable-next-line no-undef -const domain = process && process.env.NEXT_PUBLIC_DOMAIN - -if (!domain && !useLocalhost) { - throw new Error( - 'Domain is not defined! Please set NEXT_PUBLIC_DOMAIN env variable!' - ) -} const constants = { - domain: domain || 'localhost', - siteUrl: useLocalhost ? 'http://localhost:8080/' : `https://${domain}/`, - apiUrl: useLocalhost - ? 'http://localhost:8080/api/' - : `https://${domain}/api/`, + siteUrl: useLocalhost ? 'http://localhost:8080/' : '/', + apiUrl: useLocalhost ? 'http://localhost:8080/api/' : '/', maxQuestionsToRender: 250, } diff --git a/src/pages/index.js b/src/pages/index.js index 6306c61..12fcfd9 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -13,6 +13,8 @@ import styles from './index.module.css' import commonStyles from '../commonStyles.module.css' import constants from '../constants.js' +const domain = typeof window !== 'undefined' ? window.location.domain : '' + const Infos = ({ onClick, renderOKButton }) => { return (
@@ -168,9 +170,7 @@ export default function Index({ router }) { return ( <> - - Tárgyak - Data Editor | {constants.domain} - + Tárgyak - Data Editor | {domain} - - Kérdések - Data Editor | {constants.domain} - + Kérdések - Data Editor | {domain} - - Kérdés beküldés - Data Editor | {constants.domain} - + Kérdés beküldés - Data Editor | {domain} - Kitöltetlen tesztek - Data Editor |{' '} - {constants.domain} + Kitöltetlen tesztek - Data Editor | {domain}