Skip to main content
Version: Next 🚧

Configurations

This module manages the global configuration settings required to connect to the Sinequa platform. It provides:

  • A global configuration object with default values
  • A function to merge custom settings into the global configuration
  • Options to control authentication, user overrides, logging, and routing

globalConfig​

The global configuration object used by all modules (authentication, API calls, logging, etc.).

Default values
{
"loginPath": "/login",
"createRoutes": false
}

The backendUrl is automatically set to window.location.origin by appInitializerFn() if not specified.

Type

type AppGlobalConfig<T extends Record<string, any> = {}> = {
app: string;
backendUrl: string;
autoOAuthProvider: string;
autoSAMLProvider: string;
bearerToken: string;
loginPath: string;
userOverride: {
username: string;
domain: string;
};
userOverrideActive: boolean;
useCredentials: boolean; // when true, credentials are sent with requests
useSSO: boolean; // when true, SSO is used
useSAML: boolean; // when true, SAML is used even if OAuth is available
logLevel: LogLevel; // controls the application log level
createRoutes: boolean; // when true, the application creates routes (default: false)
} & T;

Example

read-global-config.ts
import { globalConfig } from '@sinequa/atomic';

console.log(globalConfig.loginPath); // '/login'
console.log(globalConfig.app); // undefined until set

setGlobalConfig()​

Merges a partial configuration object into the existing global configuration.

Parameters

ParameterTypeRequiredDescription
configPartial<AppGlobalConfig>✓Configuration properties to merge. Supports custom properties via generic type extension.

Returns void

Example

set-global-config.ts
import { globalConfig, setGlobalConfig } from '@sinequa/atomic';

setGlobalConfig({ app: 'training', logLevel: LogLevel.DEBUG });

console.log(globalConfig.app); // 'training'

Configuration Schema​


Summary Table​

PropertyTypeDefaultDescription
appstring—Sinequa application name
backendUrlstringwindow.location.originURL of the backend server
autoOAuthProviderstring—Name of the OAuth provider
autoSAMLProviderstring—Name of the SAML provider
bearerTokenstring—Bearer token for authentication
loginPathstring'/login'Login route path
userOverride{ username, domain }—User override credentials
userOverrideActiveboolean—Whether user override is active
useCredentialsboolean—Send credentials with requests
useSSOboolean—Use SSO for authentication
useSAMLboolean—Use SAML even if OAuth is available
logLevelLogLevel—Application log level
createRoutesbooleanfalseCreate routes for the application
note

All properties are optional when calling setGlobalConfig(). The AppGlobalConfig type supports additional custom properties via its generic parameter T.