Skip to content

Commit 9f417ce

Browse files
authored
Merge pull request #2244 from maevsi/ci/test/app-subdomain
ci: test with app subdomain
2 parents d5d6f9a + 1927766 commit 9f417ce

File tree

15 files changed

+57
-70
lines changed

15 files changed

+57
-70
lines changed

β€Ž.github/workflows/ci.ymlβ€Ž

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ jobs:
2828
secrets:
2929
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
3030
with:
31-
APT_PACKAGES: mkcert
3231
DRY_RUN: true
3332
build:
3433
name: Build
@@ -37,6 +36,8 @@ jobs:
3736
permissions:
3837
packages: write
3938
with:
39+
BUILD_ADD_HOSTS: |
40+
app.localhost=127.0.0.1
4041
BUILD_ARGUMENTS: ${{ (needs.release_semantic_dry.outputs.new_release_version != null) && format('RELEASE_NAME={0}', needs.release_semantic_dry.outputs.new_release_version) || '' }}
4142
TAG: ${{ (needs.release_semantic_dry.outputs.new_release_version != null) && needs.release_semantic_dry.outputs.new_release_version || '' }}
4243
secrets:
@@ -50,5 +51,3 @@ jobs:
5051
id-token: write
5152
secrets:
5253
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
53-
with:
54-
APT_PACKAGES: mkcert

β€ŽDockerfileβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ RUN --mount=type=secret,id=SENTRY_AUTH_TOKEN,env=SENTRY_AUTH_TOKEN \
9090

9191
# FROM prepare AS build-static
9292

93-
# ARG NUXT_PUBLIC_SITE_URL=https://localhost:3002
94-
# ENV NUXT_PUBLIC_SITE_URL=${NUXT_PUBLIC_SITE_URL}
93+
# ARG NUXT_PUBLIC_I18N_BASE_URL=https://localhost:3002
94+
# ENV NUXT_PUBLIC_I18N_BASE_URL=${NUXT_PUBLIC_I18N_BASE_URL}
9595

9696
# ENV NODE_ENV=production
9797
# RUN pnpm --dir src run build:static

β€Žsrc/config/modules/index.tsβ€Ž

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ export const modulesConfig: ReturnType<DefineNuxtConfig> = {
2020
fonts: {
2121
families: [
2222
{
23+
formats: ['ttf'],
24+
global: true,
2325
name: 'Raleway',
26+
provider: 'fontsource',
2427
weights: [400, 700],
25-
global: true,
26-
formats: ['ttf'],
2728
},
2829
],
2930
},
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
export const IS_IN_PRODUCTION = process.env.NODE_ENV === 'production'
2-
export const IS_IN_STACK = !!process.env.NUXT_PUBLIC_SITE_URL
2+
export const IS_IN_STACK = !!process.env.NUXT_PUBLIC_I18N_BASE_URL
33
export const IS_IN_FRONTEND_DEVELOPMENT = !IS_IN_PRODUCTION && !IS_IN_STACK
44

55
export const IS_NITRO_OPENAPI_ENABLED =
66
!!process.env.NUXT_IS_NITRO_OPENAPI_ENABLED || false
77
export const NUXT_PUBLIC_VIO_ENVIRONMENT = process.env.NODE_ENV
88
export const SITE_URL =
9-
process.env.NUXT_PUBLIC_SITE_URL ||
9+
process.env.NUXT_PUBLIC_I18N_BASE_URL ||
1010
`https://${process.env.HOST || 'app.localhost'}:${process.env.PORT || '3000'}`
1111
export const SITE_URL_TYPED = new URL(SITE_URL)

β€Žsrc/server/utils/constants.tsβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const GET_CSP = ({
1111
}) => {
1212
const domainTldPort = IS_IN_FRONTEND_DEVELOPMENT
1313
? PRODUCTION_HOST
14-
: siteUrl.host
14+
: getRootHost(siteUrl.host)
1515

1616
return defu(
1717
// if (isHttps(event.node.req)) {
@@ -22,7 +22,7 @@ export const GET_CSP = ({
2222
// app
2323
'connect-src': [
2424
'blob:', // vue-advanced-cropper
25-
`https://${domainTldPort}`, // `/api` requests
25+
`https://app.${domainTldPort}`, // `/api` requests
2626
`https://postgraphile.${domainTldPort}`, // backend requests
2727
`https://tusd.${domainTldPort}`, // image upload requests
2828
'https://nominatim.openstreetmap.org/search', // map's geocoder

β€Žsrc/shared/utils/networking.tsβ€Ž

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ export const getHost = (event: H3Event) => {
1313

1414
export { getIsSecure } from '~~/node/static'
1515

16+
export const getRootHost = (host: string) => {
17+
const hostParts = host.split('.')
18+
const hostPartsLast = hostParts[hostParts.length - 1]
19+
20+
if (hostPartsLast && /^localhost(:[0-9]+)?$/.test(hostPartsLast))
21+
return hostPartsLast
22+
23+
if (hostParts.length === 1) return hostParts[0]
24+
25+
return `${hostParts[hostParts.length - 2]}.${hostPartsLast}`
26+
}
27+
1628
export const getServiceHref = ({
1729
host,
1830
isSsr = true,

β€Žtests/e2e/fixtures/appTest.tsβ€Ž

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,19 @@ export const appTest = test.extend<{
4545
defaultPage: async ({ page, context }, use) => {
4646
await context.addCookies([
4747
{
48-
domain: 'localhost',
48+
domain: 'app.localhost',
4949
name: TESTING_COOKIE_NAME,
5050
path: '/',
5151
value: 'true',
5252
},
5353
{
54-
domain: 'localhost',
54+
domain: 'app.localhost',
5555
name: TIMEZONE_COOKIE_NAME,
5656
path: '/',
5757
value: TIMEZONE_DEFAULT,
5858
},
5959
{
60-
domain: 'localhost',
60+
domain: 'app.localhost',
6161
name: COOKIE_CONTROL_CONSENT_COOKIE_NAME,
6262
path: '/',
6363
value: COOKIE_CONTROL_CONSENT_COOKIE_DEFAULT_VALUE,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"@context":"https://schema.org","@graph":[{"@id":"https://localhost:3001/#website","@type":"WebSite","description":"Find events, guests and friends πŸ’™β€οΈπŸ’š","inLanguage":"en","name":"Vibetype","url":"https://localhost:3001/","workTranslation":{"@id":"https://localhost:3001/de#website"}},{"@id":"https://localhost:3001/#webpage","@type":"WebPage","description":"Find events, guests and friends πŸ’™β€οΈπŸ’š","name":"Vibetype","url":"https://localhost:3001/","isPartOf":{"@id":"https://localhost:3001/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://localhost:3001/"]}]}]}
1+
{"@context":"https://schema.org","@graph":[{"@id":"https://app.localhost:3001/#website","@type":"WebSite","description":"Find events, guests and friends πŸ’™β€οΈπŸ’š","inLanguage":"en","name":"Vibetype","url":"https://app.localhost:3001/","workTranslation":{"@id":"https://app.localhost:3001/de#website"}},{"@id":"https://app.localhost:3001/#webpage","@type":"WebPage","description":"Find events, guests and friends πŸ’™β€οΈπŸ’š","name":"Vibetype","url":"https://app.localhost:3001/","isPartOf":{"@id":"https://app.localhost:3001/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://app.localhost:3001/"]}]}]}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"@context":"https://schema.org","@graph":[{"@id":"https://localhost:3001/#website","@type":"WebSite","description":"Find events, guests and friends πŸ’™β€οΈπŸ’š","inLanguage":"en","name":"Vibetype","url":"https://localhost:3001/","workTranslation":{"@id":"https://localhost:3001/de#website"}},{"@id":"https://localhost:3001/#webpage","@type":"WebPage","description":"Find events, guests and friends πŸ’™β€οΈπŸ’š","name":"Vibetype","url":"https://localhost:3001/","isPartOf":{"@id":"https://localhost:3001/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://localhost:3001/"]}]}]}
1+
{"@context":"https://schema.org","@graph":[{"@id":"https://app.localhost:3001/#website","@type":"WebSite","description":"Find events, guests and friends πŸ’™β€οΈπŸ’š","inLanguage":"en","name":"Vibetype","url":"https://app.localhost:3001/","workTranslation":{"@id":"https://app.localhost:3001/de#website"}},{"@id":"https://app.localhost:3001/#webpage","@type":"WebPage","description":"Find events, guests and friends πŸ’™β€οΈπŸ’š","name":"Vibetype","url":"https://app.localhost:3001/","isPartOf":{"@id":"https://app.localhost:3001/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://app.localhost:3001/"]}]}]}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"@context":"https://schema.org","@graph":[{"@id":"https://localhost:3001/#website","@type":"WebSite","description":"Find events, guests and friends πŸ’™β€οΈπŸ’š","inLanguage":"en","name":"Vibetype","url":"https://localhost:3001/","workTranslation":{"@id":"https://localhost:3001/de#website"}},{"@id":"https://localhost:3001/#webpage","@type":"WebPage","description":"Find events, guests and friends πŸ’™β€οΈπŸ’š","name":"Vibetype","url":"https://localhost:3001/","isPartOf":{"@id":"https://localhost:3001/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://localhost:3001/"]}]}]}
1+
{"@context":"https://schema.org","@graph":[{"@id":"https://app.localhost:3001/#website","@type":"WebSite","description":"Find events, guests and friends πŸ’™β€οΈπŸ’š","inLanguage":"en","name":"Vibetype","url":"https://app.localhost:3001/","workTranslation":{"@id":"https://app.localhost:3001/de#website"}},{"@id":"https://app.localhost:3001/#webpage","@type":"WebPage","description":"Find events, guests and friends πŸ’™β€οΈπŸ’š","name":"Vibetype","url":"https://app.localhost:3001/","isPartOf":{"@id":"https://app.localhost:3001/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://app.localhost:3001/"]}]}]}

0 commit comments

Comments
Β (0)