Skip to content

Commit

Permalink
Use 127.0.0.1 instead of localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmyersdev committed Oct 5, 2023
1 parent 2699bdd commit 168c5b7
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 18 deletions.
10 changes: 5 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CYPRESS_BASE_URL=http://localhost:8888
CYPRESS_BASE_URL=http://127.0.0.1:8888
FIREBASE_PROJECT_ID=demo-octo
FIREBASE_TOKEN=fake
NUXT_PUBLIC_CDN_URL=
Expand All @@ -19,13 +19,13 @@ NUXT_PUBLIC_FIREBASE_APP_ID=fake
NUXT_PUBLIC_FIREBASE_AUTH_DOMAIN=fake
NUXT_PUBLIC_FIREBASE_DATABASE_URL=fake
NUXT_PUBLIC_FIREBASE_DISABLED=1
NUXT_PUBLIC_FIREBASE_EMULATOR_AUTH=http://localhost:32775
NUXT_PUBLIC_FIREBASE_EMULATOR_AUTH=http://127.0.0.1:32775
NUXT_PUBLIC_FIREBASE_EMULATOR_BYPASS=
NUXT_PUBLIC_FIREBASE_EMULATOR_FIRESTORE_HOST=localhost
NUXT_PUBLIC_FIREBASE_EMULATOR_FIRESTORE_HOST=127.0.0.1
NUXT_PUBLIC_FIREBASE_EMULATOR_FIRESTORE_PORT=32776
NUXT_PUBLIC_FIREBASE_EMULATOR_FUNCTIONS_HOST=localhost
NUXT_PUBLIC_FIREBASE_EMULATOR_FUNCTIONS_HOST=127.0.0.1
NUXT_PUBLIC_FIREBASE_EMULATOR_FUNCTIONS_PORT=32779
NUXT_PUBLIC_FIREBASE_EMULATOR_STORAGE_HOST=localhost
NUXT_PUBLIC_FIREBASE_EMULATOR_STORAGE_HOST=127.0.0.1
NUXT_PUBLIC_FIREBASE_EMULATOR_STORAGE_PORT=32778
NUXT_PUBLIC_FIREBASE_LOG_LEVEL=
NUXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=fake
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ env:
NUXT_PUBLIC_FIREBASE_AUTH_DOMAIN: fake
NUXT_PUBLIC_FIREBASE_DATABASE_URL: fake
NUXT_PUBLIC_FIREBASE_DISABLED:
NUXT_PUBLIC_FIREBASE_EMULATOR_AUTH: http://localhost:32775
NUXT_PUBLIC_FIREBASE_EMULATOR_AUTH: http://127.0.0.1:32775
NUXT_PUBLIC_FIREBASE_EMULATOR_BYPASS:
NUXT_PUBLIC_FIREBASE_EMULATOR_FIRESTORE_HOST: localhost
NUXT_PUBLIC_FIREBASE_EMULATOR_FIRESTORE_HOST: 127.0.0.1
NUXT_PUBLIC_FIREBASE_EMULATOR_FIRESTORE_PORT: 32776
NUXT_PUBLIC_FIREBASE_EMULATOR_FUNCTIONS_HOST: localhost
NUXT_PUBLIC_FIREBASE_EMULATOR_FUNCTIONS_HOST: 127.0.0.1
NUXT_PUBLIC_FIREBASE_EMULATOR_FUNCTIONS_PORT: 32779
NUXT_PUBLIC_FIREBASE_EMULATOR_STORAGE_HOST: localhost
NUXT_PUBLIC_FIREBASE_EMULATOR_STORAGE_HOST: 127.0.0.1
NUXT_PUBLIC_FIREBASE_EMULATOR_STORAGE_PORT: 32778
NUXT_PUBLIC_FIREBASE_LOG_LEVEL: debug
NUXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: fake
Expand Down Expand Up @@ -132,12 +132,12 @@ jobs:
- uses: cypress-io/[email protected]
with:
build: pnpm build
config: baseUrl=http://localhost:8889
config: baseUrl=http://127.0.0.1:8889
install: false
start: |
pnpm firebase:start
pnpm preview
wait-on: 'http://localhost:8889,http://localhost:32777'
wait-on: 'http://127.0.0.1:8889,http://127.0.0.1:32777'
- uses: actions/upload-artifact@v3
if: failure()
with:
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ cp .env.example .env
Run the app in `development` mode.

```bash
# binds to localhost:8888
# binds to 127.0.0.1:8888
pnpm dev
```

Expand All @@ -80,6 +80,6 @@ The build output will be available in the `.output` directory.
### Run the `production` preview

```bash
# binds to localhost:8889
# binds to 127.0.0.1:8889
pnpm preview
```
2 changes: 1 addition & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineConfig } from 'cypress'
export default defineConfig({
downloadsFolder: 'test/cypress/downloads',
e2e: {
baseUrl: 'http://localhost:8888',
baseUrl: 'http://127.0.0.1:8888',
modifyObstructiveCode: false,
specPattern: 'test/cypress/e2e/**/*.cy.{ts,tsx}',
supportFile: 'test/cypress/support/e2e.{ts,tsx}',
Expand Down
3 changes: 3 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ export default defineNuxtConfig({
stripeMonthlyPrice: '',
},
},
devServer: {
host: '127.0.0.1',
},
sourcemap: true,
ssr: true,
tailwindcss: {
Expand Down
8 changes: 4 additions & 4 deletions src/firebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,25 @@ export const init = () => {
storageBucket: publicConfig.firebaseStorageBucket,
}

if (!verifyConfig(config)) { return }
if (!verifyConfig(config)) return

// init firebase
const app = initializeApp(config)

initializeFirestore(app, {
experimentalAutoDetectLongPolling: true
experimentalAutoDetectLongPolling: true,
})

setLogLevel(publicConfig.firebaseLogLevel || 'error')

// use emulators in development
if (location.hostname === 'localhost' && !publicConfig.firebaseEmulatorBypass) {
if (['localhost', '127.0.0.1'].includes(location.hostname) && !publicConfig.firebaseEmulatorBypass) {
connectAuthEmulator(
getAuth(),
publicConfig.firebaseEmulatorAuth,
{
disableWarnings: true,
}
},
)

connectFirestoreEmulator(
Expand Down

0 comments on commit 168c5b7

Please sign in to comment.