import { KeycloakService } from 'keycloak-angular';
import { SettingsService } from 'src/app/service/settings.service';

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