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({
data(): { requiresLogin: boolean, testerPassword: string, testerPasswordCookie: string } {
data(): { testerPassword: string, testerPasswordCookie: string } {
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: '',
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';
},
requiresLogin(): boolean {
return process.env.ENV === 'test' || !this.$locales[this.$config.locale]?.published;
},
testerPasswordValid(): boolean {
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 'http://pronouns.test:3000';
yield 'http://localhost:3000';
} else if (process.env.NODE_ENV === 'test') {
yield 'https://test.pronouns.page';
} else if (process.env.ENV === 'test') {
yield process.env.BASE_URL;
} else {
yield 'https://pronouns.page';
for (const localeDescription of Object.values(locales)) {
@ -318,6 +318,7 @@ const nuxtConfig: NuxtConfig = {
transpile: ['markdown-it'],
},
env: {
ENV: process.env.ENV!,
BASE_URL: process.env.BASE_URL!,
HOME_URL: process.env.HOME_URL || 'https://pronouns.page',
PUBLIC_KEY: fs.readFileSync(`${__dirname}/keys/public.pem`).toString(),