Setup your nuxt-typo3 application with .env, .json or TYPO3 API.
npm install nuxt-typo3-configSetup your nuxt-typo3 application with .env, .json or TYPO3 API.
Create your .env file
``bash`
mkdir config
touch config/.env.stage
It runs building process with .env.stage file
`bash`
ENV_CONFIG=stage yarn build
from TYPO3 API.
You have to specify endpoint to get specific configuration:.env.test:
`bash
#### NUXT-TYPO3 #######################################
#
Connect to TYPO3 backend by API host
#
TYPO3_CONFIG_API=https://typo3instance.com/api?type=835
#
#######################################################
``You can mockup
initialConfig by json file - for example - env.test.json is the file for local environment. `json
{
"typo3": {
"domains": [
{
"name": "localhost",
"baseURL": "https://www.mydomain.com",
"api": {
"baseURL": "https://api.mydomain.com"
},
"layouts": {
"blank-page": "blank-page"
},
"i18n": {
"defaultLocale": "uk"
}
}
]
}
}
`Setup Nuxt app
$3
Read .env files + .json with multidomains configuration
config - configuration key (for .env.production key will be "production", default: "production")
dir - your configuration directory (default: "config")
`js
import loadConfiguration from 'nuxt-typo3-config'
const env = loadConfiguration()export default {
...
typo3: env.typo3
...
}
`$3
Read .env files and get configuration from API. To get configuration you have to specify TYPO3 endpoint by variable:
TYPO3_CONFIG_API=https://yourtypo3.com/?type=835
config - configuration key (for .env.production key will be "production", default: "production")
dir - your configuration directory (default: "config")
`js
import { getConfiguration } from 'nuxt-typo3-config'setupConfig = (env) => ({
...
typo3: env.typo3
...
})
export default async () => {
const env = await getConfiguration()
return setupConfig(env)
}
``