Skip to content

Commit

Permalink
fix(nuxt): use host 0.0.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dargmuesli committed Oct 13, 2022
1 parent 8096072 commit 9fc53b9
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 28 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ RUN apt-get update \

WORKDIR /srv/app/

ENV CERTIFICATE_PATH=/srv/certificates/maevsi
ENV NODE_OPTIONS="--max-old-space-size=4096 --openssl-legacy-provider"

ENV DOCKER=true

VOLUME /srv/.pnpm-store
VOLUME /srv/app
VOLUME /srv/sqitch
Expand Down
2 changes: 1 addition & 1 deletion nuxt/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default defineConfig({
e2e: {
baseUrl: `http${
process.env.NODE_ENV === 'production' ? '' : 's'
}://127.0.0.1:3000`,
}://0.0.0.0:3000`,
setupNodeEvents(on, config) {
getCompareSnapshotsPlugin(on, config)
},
Expand Down
42 changes: 21 additions & 21 deletions nuxt/dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ create() {
cat "$(mkcert -CAROOT)/rootCA.pem" >> "$certfile"
}

if [ ! -d ".nuxt" ]; then
mkdir ".nuxt"
fi

if ls "$THIS"/.nuxt/*.key 1> /dev/null 2>&1; then
rm "$THIS"/.nuxt/*.key
fi

if ls "$THIS"/.nuxt/*.crt 1> /dev/null 2>&1; then
rm "$THIS"/.nuxt/*.crt
fi

mkcert -install
create "localhost" "localhost" "127.0.0.1"

sslCert="$THIS/.nuxt/localhost.crt"
sslKey="$THIS/.nuxt/localhost.key"

if [ -n "$DOCKER" ]; then
sslCert="/srv/certificates/maevsi.crt"
sslKey="/srv/certificates/maevsi.key"
if [ "$CERTIFICATE_PATH" != "" ]; then
sslCert="$CERTIFICATE_PATH.crt"
sslKey="$CERTIFICATE_PATH.key"
else
if [ ! -d ".nuxt" ]; then
mkdir ".nuxt"
fi

if ls "$THIS"/.nuxt/*.key 1> /dev/null 2>&1; then
rm "$THIS"/.nuxt/*.key
fi

if ls "$THIS"/.nuxt/*.crt 1> /dev/null 2>&1; then
rm "$THIS"/.nuxt/*.crt
fi

mkcert -install
create "localhost" "localhost" "127.0.0.1" "0.0.0.0"

sslCert="$THIS/.nuxt/localhost.crt"
sslKey="$THIS/.nuxt/localhost.key"
fi

nuxi dev --https --ssl-cert "$sslCert" --ssl-key "$sslKey"
8 changes: 4 additions & 4 deletions nuxt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
"description": "The manager for events supported by invitees.",
"type": "module",
"scripts": {
"dev": "cross-env HOST=127.0.0.1 NODE_TLS_REJECT_UNAUTHORIZED=0 sh dev.sh",
"dev": "cross-env HOST=0.0.0.0 NODE_TLS_REJECT_UNAUTHORIZED=0 sh dev.sh",
"build": "nuxi build",
"start": "node .output/server/index.mjs",
"cypress:open": "cypress open",
"cypress:test": "cypress run --env type=actual",
"test": "pnpm test:unit && pnpm test:integration",
"test:unit": "jest",
"test:integration:dev": "cross-env WAIT_ON_TIMEOUT=30000 NODE_OPTIONS=--use-openssl-ca start-server-and-test 'pnpm dev' 'https://127.0.0.1:3000' 'pnpm cypress:test'",
"test:integration:prod": "cross-env WAIT_ON_TIMEOUT=100000 NODE_ENV=production start-server-and-test 'pnpm build && pnpm start' 'http://127.0.0.1:3000' 'pnpm cypress:test'",
"test:integration:base": "cross-env WAIT_ON_TIMEOUT=30000 NODE_OPTIONS=--use-openssl-ca start-server-and-test 'pnpm dev' 'https://127.0.0.1:3000' 'cypress run --env type=base && rm -rf cypress/*-base-*.png'",
"test:integration:dev": "cross-env WAIT_ON_TIMEOUT=30000 NODE_OPTIONS=--use-openssl-ca start-server-and-test 'pnpm dev' 'https://0.0.0.0:3000' 'pnpm cypress:test'",
"test:integration:prod": "cross-env WAIT_ON_TIMEOUT=100000 NODE_ENV=production start-server-and-test 'pnpm build && pnpm start' 'http://0.0.0.0:3000' 'pnpm cypress:test'",
"test:integration:base": "cross-env WAIT_ON_TIMEOUT=30000 NODE_OPTIONS=--use-openssl-ca start-server-and-test 'pnpm dev' 'https://0.0.0.0:3000' 'cypress run --env type=base && rm -rf cypress/*-base-*.png'",
"test:integration:docker:build": "docker build -t maevsi/maevsi:test-integration_base --target test-integration_base ../",
"test:integration:docker:run": "docker run --rm --entrypoint docker-entrypoint.sh -v \"$PWD:/srv/app\" -u \"$(id -u):$(id -g)\" maevsi/maevsi:test-integration_base",
"test:integration:docker:br": "pnpm test:integration:docker:build && pnpm test:integration:docker:run",
Expand Down

0 comments on commit 9fc53b9

Please sign in to comment.