mongodb-js / mongodb-cloud-info

Get cloud information based on hostname

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mongodb-cloud-info

Get cloud information based on hostname.

Usage

Pass a service hostname to the getCloudInfo() function to get cloud information.

import get from 'lodash.get';
import { getCloudInfo } from 'mongodb-cloud-info';

async function getCloudInfoFromDataService(dataService) {
  try {
    const firstServerHostname = get(dataService, 'client.model.hosts.0.host');
    
    return await getCloudInfo(firstServerHostname);
  } catch (e) {
    return {};
  }
}

The return object

{
  isAws: false,
  isGcp: false,
  isAzure: false
}

About

Get cloud information based on hostname

License:Apache License 2.0


Languages

Language:JavaScript 100.0%