mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Refactor use of .env variables after Moriz suggestions
This commit is contained in:
parent
a63eb04385
commit
4c8fb83dcd
@ -82,8 +82,8 @@ const options = {
|
|||||||
SUPPORT_URL: links.SUPPORT,
|
SUPPORT_URL: links.SUPPORT,
|
||||||
APPLICATION_NAME: metadata.APPLICATION_NAME,
|
APPLICATION_NAME: metadata.APPLICATION_NAME,
|
||||||
ORGANIZATION_URL: links.ORGANIZATION,
|
ORGANIZATION_URL: links.ORGANIZATION,
|
||||||
PUBLIC_REGISTRATION: env.PUBLIC_REGISTRATION === 'true', // because env booleans are given as string in differenz to the webapp
|
PUBLIC_REGISTRATION: env.PUBLIC_REGISTRATION === 'true' || false,
|
||||||
INVITE_REGISTRATION: env.INVITE_REGISTRATION === 'true', // because env booleans are given as string in differenz to the webapp
|
INVITE_REGISTRATION: env.INVITE_REGISTRATION !== 'false', // default = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if all required configs are present
|
// Check if all required configs are present
|
||||||
|
|||||||
@ -29,8 +29,8 @@ const sentry = {
|
|||||||
const options = {
|
const options = {
|
||||||
VERSION: process.env.VERSION || pkg.version,
|
VERSION: process.env.VERSION || pkg.version,
|
||||||
DESCRIPTION: process.env.DESCRIPTION || pkg.description,
|
DESCRIPTION: process.env.DESCRIPTION || pkg.description,
|
||||||
PUBLIC_REGISTRATION: process.env.PUBLIC_REGISTRATION, // because env booleans are given as booleans and not as strings in differenz to the backend
|
PUBLIC_REGISTRATION: process.env.PUBLIC_REGISTRATION === 'true' || false,
|
||||||
INVITE_REGISTRATION: process.env.INVITE_REGISTRATION, // because env booleans are given as booleans and not as strings in differenz to the backend
|
INVITE_REGISTRATION: process.env.INVITE_REGISTRATION !== 'false', // default = true
|
||||||
// Cookies
|
// Cookies
|
||||||
COOKIE_EXPIRE_TIME: process.env.COOKIE_EXPIRE_TIME || 730, // Two years by default
|
COOKIE_EXPIRE_TIME: process.env.COOKIE_EXPIRE_TIME || 730, // Two years by default
|
||||||
COOKIE_HTTPS_ONLY: process.env.COOKIE_HTTPS_ONLY || process.env.NODE_ENV === 'production', // ensure true in production if not set explicitly
|
COOKIE_HTTPS_ONLY: process.env.COOKIE_HTTPS_ONLY || process.env.NODE_ENV === 'production', // ensure true in production if not set explicitly
|
||||||
|
|||||||
@ -27,7 +27,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
env: {
|
env: {
|
||||||
release: CONFIG.VERSION,
|
...CONFIG,
|
||||||
// pages which do NOT require a login
|
// pages which do NOT require a login
|
||||||
publicPages: [
|
publicPages: [
|
||||||
'login',
|
'login',
|
||||||
|
|||||||
@ -25,16 +25,14 @@ export default {
|
|||||||
nonce,
|
nonce,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
publicRegistration: this.$env.PUBLIC_REGISTRATION === 'true', // for 'false' in .env PUBLIC_REGISTRATION is of type undefined and not(!) boolean false, because of internal handling
|
||||||
|
inviteRegistration: this.$env.INVITE_REGISTRATION === 'true', // for 'false' in .env INVITE_REGISTRATION is of type undefined and not(!) boolean false, because of internal handling
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
asyncData({ app, store, redirect }) {
|
asyncData({ store, redirect }) {
|
||||||
if (store.getters['auth/isLoggedIn']) {
|
if (store.getters['auth/isLoggedIn']) {
|
||||||
redirect('/')
|
redirect('/')
|
||||||
}
|
}
|
||||||
return {
|
|
||||||
publicRegistration: app.$env.PUBLIC_REGISTRATION,
|
|
||||||
inviteRegistration: app.$env.INVITE_REGISTRATION,
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
registrationType() {
|
registrationType() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user