pulumi/sdk/nodejs/metadata.ts
joeduffy 599ca8ea43 Add accessors to fetch the Pulumi project and stack names
This change adds functions, `pulumi.getProject()` and `pulumi.getStack()`,
to fetch the names of the project and stack, respectively.  These can be
handy in generating names, specializing areas of the code, etc.

This fixes pulumi/pulumi#429.
2017-10-19 08:26:57 -07:00

20 lines
533 B
TypeScript

// Copyright 2016-2017, Pulumi Corporation. All rights reserved.
// This file exports metadata about the context in which a program is being run.
import * as runtime from "./runtime";
/**
* getStack returns the current project name, or the empty string if there is none.
*/
export function getProject(): string {
return runtime.options.project || "";
}
/**
* getStack returns the current stack name, or the empty string if there is none.
*/
export function getStack(): string {
return runtime.options.stack || "";
}