1.2.0 • Published 5 years ago

detect-cloud v1.2.0

Weekly downloads
3
License
MIT
Repository
gitlab
Last release
5 years ago

pipeline status coverage report MIT license npm version

detect-cloud

This node module is inspired by the golang library Satellite. Most of the code is based on the same techniques used by Satellite.

Supported Cloud Providers

  • Alibaba
  • Amazon
  • Azure
  • DigitialOcean
  • Google Cloud
  • Oracle

Usage

It will check for every supported cloud provider by default:

import detectCloud, {keys} from 'detect-cloud';

const provider = await detectCloud();
switch (provider) {
    case keys.AWS:
        // AWS related code.
        break;
    case keys.Azure:
        // Azure related code.
        break;
    ...  
}

Or if you wont support certain clouds, or want to skip that:

import detectCloud, {keys} from 'detect-cloud';

const provider = await detectCloud(keys.GCP, keys.Azure);
switch (provider) {
    case keys.AWS:
        // AWS related code.
        break;
    case keys.DO:
        // DO related code.
        break;
    ...  
}

Contributing

If you find this project useful here's how you can help:

  • Check if your bug or feature was already reported
  • Create a merge request with your changes
    • Make sure the tests are also working and updated