Define uiDisabled at build time.

This commit is contained in:
Mike Cao 2022-10-27 17:02:54 -07:00
parent fc9584eb44
commit 98835bbc78
3 changed files with 2 additions and 5 deletions

View File

@ -36,6 +36,7 @@ module.exports = {
env: {
currentVersion: pkg.version,
isProduction: process.env.NODE_ENV === 'production',
uiDisabled: !!process.env.DISABLE_UI,
},
basePath: process.env.BASE_PATH,
output: 'standalone',

View File

@ -2,7 +2,6 @@ import Head from 'next/head';
import { useRouter } from 'next/router';
import { IntlProvider } from 'react-intl';
import useLocale from 'hooks/useLocale';
import useConfig from 'hooks/useConfig';
import 'styles/variables.css';
import 'styles/bootstrap-grid.css';
import 'styles/index.css';
@ -24,9 +23,8 @@ const Intl = ({ children }) => {
export default function App({ Component, pageProps }) {
const { basePath } = useRouter();
const { dir } = useLocale();
const { uiDisabled } = useConfig();
if (uiDisabled) {
if (!process.env.uiDisabled) {
return null;
}

View File

@ -7,9 +7,7 @@ export default async (req, res) => {
trackerScriptName: process.env.TRACKER_SCRIPT_NAME,
updatesDisabled: !!process.env.DISABLE_UPDATES,
telemetryDisabled: !!process.env.DISABLE_TELEMETRY,
loginDisabled: !!process.env.DISABLE_LOGIN,
adminDisabled: !!process.env.DISABLE_ADMIN,
uiDisabled: !!process.env.DISABLE_UI,
});
}