Merge branch 'multiple-test-envs' into 'main'

multiple test envs

See merge request PronounsPage/PronounsPage!466
This commit is contained in:
Valentyne Stigloher 2024-05-31 12:41:08 +00:00
commit 40b9b6f9f5
2 changed files with 7 additions and 9 deletions

View File

@ -73,14 +73,8 @@ declare module 'vue/types/vue' {
} }
export default dark.extend({ export default dark.extend({
data(): { requiresLogin: boolean, testerPassword: string, testerPasswordCookie: string } { data(): { testerPassword: string, testerPasswordCookie: string } {
return { return {
requiresLogin: this.$config.locale !== '_' && (
!this.$locales[this.$config.locale] ||
!this.$locales[this.$config.locale].published ||
process.env.NODE_ENV === 'test' ||
process.env.BASE_URL!.includes('test.pronouns.page')
),
testerPassword: '', testerPassword: '',
testerPasswordCookie: this.$cookies.get(TESTER_PASSWORD_COOKIE_KEY), testerPasswordCookie: this.$cookies.get(TESTER_PASSWORD_COOKIE_KEY),
}; };
@ -96,6 +90,9 @@ export default dark.extend({
return !!this.$config.ads?.enabled && process.env.NODE_ENV !== 'development'; return !!this.$config.ads?.enabled && process.env.NODE_ENV !== 'development';
}, },
requiresLogin(): boolean {
return process.env.ENV === 'test' || !this.$locales[this.$config.locale]?.published;
},
testerPasswordValid(): boolean { testerPasswordValid(): boolean {
return !!this.testerPasswordCookie && md5(this.testerPasswordCookie) === TESTER_PASSWORD_HASH; return !!this.testerPasswordCookie && md5(this.testerPasswordCookie) === TESTER_PASSWORD_HASH;
}, },

View File

@ -45,8 +45,8 @@ const allVersionsUrls = buildList(function*() {
yield process.env.BASE_URL; yield process.env.BASE_URL;
yield 'http://pronouns.test:3000'; yield 'http://pronouns.test:3000';
yield 'http://localhost:3000'; yield 'http://localhost:3000';
} else if (process.env.NODE_ENV === 'test') { } else if (process.env.ENV === 'test') {
yield 'https://test.pronouns.page'; yield process.env.BASE_URL;
} else { } else {
yield 'https://pronouns.page'; yield 'https://pronouns.page';
for (const localeDescription of Object.values(locales)) { for (const localeDescription of Object.values(locales)) {
@ -318,6 +318,7 @@ const nuxtConfig: NuxtConfig = {
transpile: ['markdown-it'], transpile: ['markdown-it'],
}, },
env: { env: {
ENV: process.env.ENV!,
BASE_URL: process.env.BASE_URL!, BASE_URL: process.env.BASE_URL!,
HOME_URL: process.env.HOME_URL || 'https://pronouns.page', HOME_URL: process.env.HOME_URL || 'https://pronouns.page',
PUBLIC_KEY: fs.readFileSync(`${__dirname}/keys/public.pem`).toString(), PUBLIC_KEY: fs.readFileSync(`${__dirname}/keys/public.pem`).toString(),