import { KeycloakService } from 'keycloak-angular';
import { ConfigService } from 'src/app/service/config.service';

export function initializeKeycloak(
  keycloak: KeycloakService,
  config: ConfigService
): Promise<boolean> {
  return keycloak.init({
    config: {
      url: config.settings.keycloak.url,
      realm: config.settings.keycloak.realm,
      clientId: config.settings.keycloak.clientId,
    },
    initOptions: {
      onLoad: 'check-sso',
      checkLoginIframe: false,
    },
    enableBearerInterceptor: false,
  });
}
