DefinitelyTyped/types/cfenv/index.d.ts
Jordan Adams 56a540b7fc
Adds @types/cfenv (#42503)
* adds types for cfenv

* changes AppEnv from exported class to interface
2020-02-20 11:02:47 -08:00

42 lines
1.0 KiB
TypeScript

// 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: object;
}
export interface AppEnv {
app: object;
isLocal: boolean;
name: string;
port: number;
bind: string;
urls: string[];
url: string;
services: object;
toJSON: () => string;
getServices: () => { [key: string]: Service };
getService: (spec: string | RegExp) => Service | null;
getServiceURL: (spec: string | RegExp, replacements?: object) => string | null;
getServiceCreds: (spec: string | RegExp) => object | null;
}
export interface GetAppEnvOptions {
name?: string;
protocol?: string;
vcap?: {
application?: string;
services?: string;
};
vcapFile?: string;
}
export function getAppEnv(options?: GetAppEnvOptions): AppEnv;