//@ts-ignore
const environment = process.env;

let env_var: string | undefined;

if (environment.APP_ENV == 'test') {
  env_var = environment.OPENBAO__SETTINGS_TEST__REACT_APP_API_URL;
} else {
  env_var = environment.OPENBAO__SETTINGS__REACT_APP_API_URL;
}

export class Config {
  static API_URL: string =
    env_var ??
    environment.REACT_APP_API_URL ??
    environment.REACT_APP_ROOT_PATH ??
    '';
  static KEYCLOAK_URL: string = environment.REACT_APP_KEYCLOAK_URL ?? '';
  static REALM: string = environment.REACT_APP_REALM ?? '';
  static CLIENT_ID: string = environment.REACT_APP_CLIENT_ID ?? '';
  static NAMESPACE: string = environment.REACT_APP_NAMESPACE ?? '';
  static APP_NAME: string = environment.REACT_APP_APP_NAME ?? '';
}

export const isTestMode =
  environment.REACT_APP_BASE_PATH !== environment.REACT_APP_ROOT_PATH;
