@grafctory/gear
    Preparing search index...

    Variable gcpConst

    gcp: {
        get cloud(): boolean;
        get port(): number;
        get project(): Promise<string>;
    } = ...

    The Google Cloud Platform execution environment.

    Exposes the ambient settings shared by the Google Cloud integrations, such as whether the process is deployed to a Google Cloud runtime, which port its HTTP service listens on and which project it runs in. Each setting is resolved on first access and retained afterwards, so later changes to the environment of the process are not reflected.

    Type Declaration

    • get cloud(): boolean

      Whether the current process is running on Google Cloud.

      The flag is set for a process deployed to Cloud Run, Cloud Functions, App Engine, Google Kubernetes Engine or Compute Engine. It is cleared for a process running locally, such as a development server or a test runner.

    • get port(): number

      The port an HTTP service is expected to listen on.

      The port is read from the PORT environment variable, which managed Google Cloud runtimes set to the port they route requests to; it defaults to 8080 if the variable is unset or empty.

    • get project(): Promise<string>

      The ID of the Google Cloud project the process runs in.

      On a Google Cloud runtime the project is the one the process is deployed to; locally it is the one selected by the application default credentials or by the gcloud configuration. The promise rejects if no project is configured for the process.