tenants.config.ts file. When you want to use a different filename, you can use the configFile option to configure the filename.The defineNuxtMultiTenancyConfig utility is used to define the multi-tenancy config.
It accepts a function or promise that returns an array of tenant configurations, or an array of tenant configurations directly.
This function will be called before the Nuxt application initializes the site config from @nuxtjs/seo.
export default defineNuxtMultiTenancyConfig([{
hosts: ["localhost:3000"],
// ...
}]);
You might want to load the tenant configurations or parts of the configuration from a external source. You can do this by using an async function.
export default defineNuxtMultiTenancyConfig(async () => {
// Any async code here...
return [{
hosts: ["localhost:3000"],
// ...
}];
});
function defineNuxtMultiTenancyConfig<T extends TenantConfig>(config: T[] | (() => T[] | Promise<T[]>)): Promise<T[]>;
Take a look at the configuration section for more information on what properties are available / required.
The defineNuxtMultiTenancyConfig function returns a promise that resolves to an array of tenant configurations. Below you can find the properties that are available / required for the tenant configuration.
Alternatively, see the TenantConfig type definition for more information.
hosts option to set the hosts of the tenants.http/https) and www prefix.export default defineNuxtMultiTenancyConfig([{
hosts: [
"canonicalurl.nl",
"canonical.staging.dev",
],
// ...
}])
url option to set the canonical Site URL of the tenant.export default defineNuxtMultiTenancyConfig([{
hosts: [],
config: {
url: "https://canonicalurl.nl",
// ...
},
}])
export default defineNuxtMultiTenancyConfig([{
hosts: [],
config: {
url: "https://canonicalurl.nl",
name: "Canonical URL",
// ...
},
}])
http://canonical.localhost:3000)export default defineNuxtMultiTenancyConfig([{
hosts: [],
config: {
url: "https://canonicalurl.nl",
name: "Canonical URL",
tenant: {
id: "canonical",
// ...
},
},
}])
export default defineNuxtMultiTenancyConfig([{
hosts: [],
config: {
url: "https://canonicalurl.nl",
name: "Canonical URL",
tenant: {
site: {
"nl-NL": "canonical-nl-NL",
},
// ...
},
},
}])
publicRuntimeConfig option of the nuxt.config.ts file.export default defineNuxtMultiTenancyConfig([{
hosts: [],
config: {
url: "https://canonicalurl.nl",
name: "Canonical URL",
tenant: {
publicRuntimeConfig: {
scripts: {
googleTagManager: {
id: "",
},
},
},
},
},
}])