Skip to content

Commit

Permalink
docs: add example of runtime domain configuration to the guide
Browse files Browse the repository at this point in the history
  • Loading branch information
cjpearson committed Sep 28, 2023
1 parent 46fcbc4 commit b952ca4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/content/2.guide/10.different-domains.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,19 @@ export default defineNuxtConfig({
// ...
})
```

With the above config, a build would have to be run for staging and production with different .env files that specify `DOMAIN_UK` and `DOMAIN_FR`.

Alternatively, to avoid the need for multiple builds, the locale domains can be overridden via runtime environment variables. The variable name should follow the format `NUXT_PUBLIC_I18N_LOCALES_{locale code}_DOMAIN`

For example:

```env {}[production .env]
NUXT_PUBLIC_I18N_LOCALES_UK_DOMAIN=uk.example.test
NUXT_PUBLIC_I18N_LOCALES_FR_DOMAIN=fr.example.test
```

```env {}[staging .env]
NUXT_PUBLIC_I18N_LOCALES_UK_DOMAIN=uk.staging.example.test
NUXT_PUBLIC_I18N_LOCALES_FR_DOMAIN=fr.staging.example.test
```

0 comments on commit b952ca4

Please sign in to comment.