Initial Project Commit
This commit is contained in:
commit
a6dea9c888
2148 changed files with 173870 additions and 0 deletions
|
@ -0,0 +1,29 @@
|
|||
import { inject, Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { ApplicationConfigService } from 'app/core/config/application-config.service';
|
||||
import { Bean, Beans, ConfigProps, Env, PropertySource } from './configuration.model';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class ConfigurationService {
|
||||
private http = inject(HttpClient);
|
||||
private applicationConfigService = inject(ApplicationConfigService);
|
||||
|
||||
getBeans(): Observable<Bean[]> {
|
||||
return this.http.get<ConfigProps>(this.applicationConfigService.getEndpointFor('management/configprops')).pipe(
|
||||
map(configProps =>
|
||||
Object.values(
|
||||
Object.values(configProps.contexts)
|
||||
.map(context => context.beans)
|
||||
.reduce((allBeans: Beans, contextBeans: Beans) => ({ ...allBeans, ...contextBeans }), {}),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
getPropertySources(): Observable<PropertySource[]> {
|
||||
return this.http.get<Env>(this.applicationConfigService.getEndpointFor('management/env')).pipe(map(env => env.propertySources));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue