Settings Loaders

Settings Loaders

This document describes the different settings loaders used to load and merge settings for the ConfluenceSettings configuration object. Each loader is responsible for loading settings from a specific source, and they can be combined to create a merged configuration.

DefaultSettingsLoader

Purpose: Load default settings from the DEFAULT_SETTINGS object.

Settings source: DEFAULT_SETTINGS object.

Example:

const defaultLoader = new DefaultSettingsLoader(); const defaultSettings = defaultLoader.loadPartial();

StaticSettingsLoader

Purpose: Load settings provided as a static object.

Settings source: User-provided object.

Example:

const staticSettings = { confluenceBaseUrl: "https://example.com", confluenceParentId: "12345", }; const staticLoader = new StaticSettingsLoader(staticSettings); const loadedSettings = staticLoader.loadPartial();

EnvironmentVariableSettingsLoader

Purpose: Load settings from environment variables.

Settings source: Environment variables.

Example:

Set the environment variables:

export CONFLUENCE_BASE_URL=https://example.com export CONFLUENCE_PARENT_ID=12345

Load settings from environment variables:

ConfigFileSettingsLoader

Purpose: Load settings from a JSON configuration file.

Settings source: User-specified JSON configuration file.

Example:

Create a JSON configuration file (.mermaid-confluence.json):

Load settings from the configuration file:

CommandLineArgumentSettingsLoader

Purpose: Load settings from command line arguments.

Settings source: Command line arguments.

Example:

Pass settings as command line arguments:

Load settings from command line arguments:

AutoSettingsLoader

Purpose: Automatically load and merge settings from multiple loaders.

Settings source: Multiple settings loaders.

Example:

Create an AutoSettingsLoader with custom loaders: