Skip to content

Commit f30a8ce

Browse files
committed
[NAE-2116] Frontend remote configuration
- documentation
1 parent 34613a6 commit f30a8ce

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

projects/netgrif-components-core/src/lib/configuration/application-configuration.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
import {NetgrifApplicationEngine} from '../../commons/schema';
22

3+
/**
4+
* Interface representing the configuration settings for an application.
5+
* This configuration defines the essential properties required to initialize
6+
* or operate an application within a specific context or environment.
7+
*
8+
* @interface ApplicationConfiguration
9+
*
10+
* @property application
11+
* Specifies the name or identifier of the application.
12+
*
13+
* @property type
14+
* Indicates the type or category of the application.
15+
*
16+
* @property [resolve_configuration]
17+
* Optional flag that determines whether the configuration should
18+
* be resolved dynamically.
19+
*
20+
* @property [gateway_url]
21+
* Optional URL used as the gateway endpoint for the application's communication.
22+
*
23+
* @property [properties]
24+
* Properties of the application representing the whole application configuration
25+
* that is typically located inside nae.json.
26+
*/
327
export interface ApplicationConfiguration {
428
application: string;
529
type: string;

projects/netgrif-components-core/src/lib/configuration/configuration.service.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,13 @@ export abstract class ConfigurationService {
259259
return config.providers.auth.address + config.providers.auth.endpoints[endpointKey];
260260
}
261261

262+
/**
263+
* Loads the configuration for the application by fetching data from the resource provider
264+
* and initializes the application settings based on the fetched configuration.
265+
*
266+
* @return {Promise<any>} A promise that resolves with the fetched configuration or returns null
267+
* if the configuration resolution is not enabled.
268+
*/
262269
public loadConfiguration(): Promise<any> {
263270
if (!this.APPLICATION_CONFIG.resolve_configuration) {
264271
return null;

projects/netgrif-components-core/src/lib/utility/load-configuration.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import {ConfigurationService} from '../configuration/configuration.service';
22

33

4+
/**
5+
* Loads the configuration from admin node using the provided configuration service.
6+
*
7+
* @param {ConfigurationService} configurationService - The service responsible for loading the configuration.
8+
* @return {Function} - A function that, when called, returns a Promise resolving to the loaded configuration or void.
9+
*/
410
export function loadConfiguration(configurationService: ConfigurationService): () => Promise<any> | void {
511
return (): Promise<any> => {
612
return configurationService.loadConfiguration();

0 commit comments

Comments
 (0)