@intlayer/config: Retrieve Intlayer configuration
Intlayer is a suite of packages designed specifically for JavaScript developers. It is compatible with frameworks like React, React, and Express.js.
The @intlayer/config
package is a NPM package that allows you to retrieve the configuration of Intlayer and define the environment variables related to the current environment.
Installation
Install the necessary package using your preferred package manager:
npm install @intlayer/config
pnpm add @intlayer/config
yarn add @intlayer/config
Usage
Read the configuration of Intlayer using file system
Example:
import { getConfiguration, type IntlayerConfig } from "@intlayer/config";
const config: IntlayerConfig = getConfiguration();
console.log(config);
This function use fs
packages and will only work on the server side.
Read the configuration of Intlayer using environment variables
Example:
import { getConfiguration, type IntlayerConfig } from "@intlayer/config/client";
const config: IntlayerConfig = getConfiguration({
env: "production",
});
console.log(config);
This function will not return anything if the environment variables are not defined.
Define the environment variables
- Create a configuration file.
import { type IntlayerConfig } from "intlayer";
const config: IntlayerConfig = {
internationalization: {
},
middleware: {
},
content: {
},
editor: {
},
};
export default config;