Skip to content
Snippets Groups Projects
AppConfiguration.ts 638 B
Newer Older
cazenave's avatar
cazenave committed
import { Injectable } from "@angular/core";
import { HttpClient } from '@angular/common/http';
cazenave's avatar
cazenave committed
import { environment } from 'src/environments/environment.prod';
cazenave's avatar
cazenave committed

@Injectable()
export class AppConfiguration {
  fdpurl: string;
  fdpemail: string;
  fdppassword: string;
cazenave's avatar
cazenave committed
  elasticurl: string;
  smartapiurl: string;
  
  constructor(private httpClient: HttpClient){};
cazenave's avatar
cazenave committed

public ensureInit(): Promise<any> {
    return new Promise((r, e) => {  
cazenave's avatar
cazenave committed
        this.httpClient.get("http://"+environment.apiurl+"/api/setting/load").subscribe((content: AppConfiguration) => {Object.assign(this, content);r(this);}, reason => e(reason));
cazenave's avatar
cazenave committed
    });
  };

}