1.2.4 • Published 7 months ago

@types/cfenv v1.2.4

Weekly downloads
2,001
License
MIT
Repository
github
Last release
7 months ago

Installation

npm install --save @types/cfenv

Summary

This package contains type definitions for cfenv (https://github.com/cloudfoundry-community/node-cfenv).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cfenv.

index.d.ts

// Type definitions for cfenv 1.2
// Project: https://github.com/cloudfoundry-community/node-cfenv
// Definitions by: Jordan Adams <https://github.com/jordanadams>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

export interface Service {
    label: string;
    name: string;
    plan: string;
    tags: string[];
    credentials: Record<string, any>;
}

export interface ApplicationConfig {
    name?: string;

    [rest: string]: any;
}

export interface ServicesConfig {
    [name: string]: Array<{
        credentials?: Record<string, any>;
        name?: string;

        [rest: string]: any;
    }>;
}

export interface AppEnv {
    app: Record<string, any>;
    isLocal: boolean;
    name: string;
    port: number;
    bind: string;
    urls: string[];
    url: string;
    services: Record<string, any>;

    toJSON: () => string;
    getServices: () => { [key: string]: Service };
    getService: (spec: string | RegExp) => Service | null;
    getServiceURL: (
        spec: string | RegExp,
        replacements?: Record<string, any>,
    ) => string | null;
    getServiceCreds: (spec: string | RegExp) => Record<string, any> | null;
}

export interface GetAppEnvOptions {
    name?: string;
    protocol?: string;
    vcap?: {
        application?: ApplicationConfig;
        services?: ServicesConfig;
    };
    vcapFile?: string;
}

export function getAppEnv(options?: GetAppEnvOptions): AppEnv;

Additional Details

  • Last updated: Tue, 04 Jan 2022 11:01:28 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Jordan Adams.