Fix module state detection

This commit is contained in:
Yarmo Mackenbach 2022-11-14 21:58:56 +01:00
parent 79a259f028
commit 751e141f91
No known key found for this signature in database
GPG key ID: 37367F4AF4087AD1
3 changed files with 9 additions and 5 deletions

View file

@ -33,10 +33,11 @@ import proxyGetApiRouter from './proxy_get.js'
const router = express.Router() const router = express.Router()
if (process.env.ENABLE_MAIN_MODULE ?? true) { if (process.env.ENABLE_MAIN_MODULE === 'true') {
router.use('/profile', keyoxideProfileApiRouter) router.use('/profile', keyoxideProfileApiRouter)
} }
if (process.env.ENABLE_PROXY_MODULE ?? true) { console.log(process.env.ENABLE_PROXY_MODULE);
if (process.env.ENABLE_PROXY_MODULE === 'true') {
router.use('/get', proxyGetApiRouter) router.use('/get', proxyGetApiRouter)
} }

View file

@ -72,7 +72,9 @@ app.use(stringReplace({
})) }))
// Routes // Routes
if (process.env.ENABLE_MAIN_MODULE ?? true) { app.use('/api', apiRoute)
if (process.env.ENABLE_MAIN_MODULE === 'true') {
console.log("lol", process.env.ENABLE_MAIN_MODULES);
app.use('/favicon.svg', express.static('./static/favicon.svg')) app.use('/favicon.svg', express.static('./static/favicon.svg'))
app.use('/robots.txt', express.static('./static/robots.txt')) app.use('/robots.txt', express.static('./static/robots.txt'))
@ -81,7 +83,6 @@ if (process.env.ENABLE_MAIN_MODULE ?? true) {
app.use('/util', utilRoute) app.use('/util', utilRoute)
app.use('/', profileRoute) app.use('/', profileRoute)
} }
app.use('/api', apiRoute)
app.listen(app.get('port'), () => { app.listen(app.get('port'), () => {
console.log(`Server listening at http://localhost:${app.get('port')}`) console.log(`Server listening at http://localhost:${app.get('port')}`)

View file

@ -34,7 +34,9 @@ import apiRouter2 from '../api/v2/index.js'
const router = express.Router() const router = express.Router()
if (process.env.ENABLE_MAIN_MODULE === 'true') {
router.use('/0', apiRouter0) router.use('/0', apiRouter0)
}
router.use('/1', apiRouter1) router.use('/1', apiRouter1)
router.use('/2', apiRouter2) router.use('/2', apiRouter2)