@eac-arch/infrastructure-config
v1.0.6
Published
Angular infrastructure library for runtime configuration loading and access.
Readme
@eac-arch/infrastructure-config
Angular infrastructure library for runtime configuration loading and access.
Purpose
@eac-arch/infrastructure-config centralizes runtime configuration access through a typed service and Angular providers. It supports:
- preloaded configuration via DI
- path-based reads (
a.b.c) with safe and strict variants - browser session persistence for config reuse
- optional startup prefetch with timeout handling
Main Capabilities
ConfigService: Stores config in an Angular signal and exposes read methods.provideConfig(): RegistersConfigServiceusingPLATFORM_IDand optional preloaded config.provideConfigTesting(): Test-friendly provider with deterministic preloaded values.prefetchConfig(url, timeoutMs): Fetches runtime JSON config in browser environments.getByPath()/requireByPath(): Nested path utilities for dynamic config access.
Public API
export type { AppConfig };
export { ConfigService, APP_CONFIG_TOKEN, providePreloadedConfig };
export { provideConfig, provideConfigTesting };
export { prefetchConfig };
export { getByPath, requireByPath };Usage
import { ApplicationConfig } from '@angular/core';
import { provideConfig } from '@eac-arch/infrastructure-config';
export const appConfig: ApplicationConfig = {
providers: [
...provideConfig(),
],
};Read configuration values:
const apiBase = configService.require<string>('API.BASE_URL');
const optionalTimeout = configService.get<number>('HTTP.TIMEOUT_MS');Dependencies
- Angular core/common
tslib
No direct dependency on other @eac-arch/* packages.
Development
From eac-arch-infrastructure-config:
npm install
npm run build
npm testCreated By
Erick Arostegui Cunza
Enterprise Solutions Architect
Professional Profile:
- LinkedIn: https://www.linkedin.com/in/erick-arostegui-cunza/
Articles:
- Medium: https://medium.com/@scorpius86
Channels and Media:
- Facebook: https://www.facebook.com/Erick.Arostegui.Cunza
- TikTok: https://www.tiktok.com/@erick_arostegui_cunza
- Instagram: https://www.instagram.com/erickarosteguicunza/
- Spotify: https://open.spotify.com/show/2JQxlxcRg7k7cJ1hB52Ge5
Created by Erick Arostegui Cunza.
