CMS Configuration

TeqCMS is configured through environment variables (e.g., in the .env file) and a configuration object passed to configCms.init(). This ensures simplicity and transparency of the system's behavior.

1. Main Environment Variables

# Server type: express, fastify or built-in (if not specified)
SERVER_TYPE=express

# HTTP server port
SERVER_PORT=3000

# Template engine: nunjucks or mustache
TEQ_CMS_TMPL_ENGINE=nunjucks

# Allowed site locales
TEQ_CMS_LOCALE_ALLOWED=en,ru

# Base locale for site display
TEQ_CMS_LOCALE_BASE_DISPLAY=en

# Base locale for translation generation
TEQ_CMS_LOCALE_BASE_TRANSLATE=ru

# AI provider configuration
TEQ_CMS_AI_API_BASE_URL=https://api.openai.com/v1
TEQ_CMS_AI_API_KEY=sk-...
TEQ_CMS_AI_API_MODEL=gpt-4
TEQ_CMS_AI_API_ORG=your-org-id

2. Configuration Initialization in Code

Example of configCms.init() call:
configCms.init({
    rootPath: root,
    tmplEngine: process.env.TEQ_CMS_TMPL_ENGINE,
    localeAllowed: process.env.TEQ_CMS_LOCALE_ALLOWED.split(','),
    localeBaseDisplay: process.env.TEQ_CMS_LOCALE_BASE_DISPLAY,
    localeBaseTranslate: process.env.TEQ_CMS_LOCALE_BASE_TRANSLATE,
    aiApiBaseUrl: process.env.TEQ_CMS_AI_API_BASE_URL,
    aiApiKey: process.env.TEQ_CMS_AI_API_KEY,
    aiApiModel: process.env.TEQ_CMS_AI_API_MODEL,
    aiApiOrg: process.env.TEQ_CMS_AI_API_ORG,
});

3. Behavior Logic

4. Additional Settings

You can replace the implementation of built-in CMS components, for example, the template variables adapter:

const container = new Container();
const replace = new Replace();
replace.add('Fl32_Cms_Back_Api_Adapter', 'My_Custom_Adapter');
container.getPreProcessor().addChunk(replace);

This allows adapting CMS to any business logic without modifying the source code.

Next: working with locales →