The Environment object represents a deployment target Environment. During a deployment, there is always an Environment object on the stack representing the current deployment target Environment. This can be referenced by $Environment. An Environment object can also be retrieved using the getEnvironment Function.


The following properties can be accessed for an Environment object:


Property

Type

Description

id

Integer

Environment id, as used in the database.

name

String

Environment name.

fqdomain

String

Fully qualified domain name.

summary

String

Summary text.

domain

Object

Domain in which the Environment is contained.

owner

Object

User or UserGroup that owns the Environment.

basedir

String

Base directory for deployments.

Endpoints

Array

Array of Endpoint objects keyed by name.

Applications

Array

Array of Application Objects (Applications present in this Environment).

creator

User

User Object representing the user who created this Environment.

modifier

User

User Object representing the user who last modified this Environment.

ctime

Date

Date Object representing the date/time the Environment was created.

mtime

Date

Date Object representing the date/time the Environment was last modified.

parent

Object

Parent domain.



The following methods can be called on the Environment object:


Method

Return Type

Description

getatt(attname)

String

Returns the value of the specified attribute held against the Environment. Parameter is the attribute name.

deptime(Application)

Date

Returns a Date object representing the last time the specified Application was deployed to the Environment. Returns null if the specified Application is not currently on the Endpoint.


Note, that attributes such as owner and parent return other Objects. These objects have their own attributes. So, for example, one can get the owner name of an Environment by writing:


set owner = ${Environment.owner};

echo ${owner.name};


or, more simply:


echo ${Environment.owner.name};


Here is an example of retrieving the Endpoints in the Environment:


set servers = ${Environment.servers};

iterate(s: $servers) {

echo "server is ${s.name}";

echo "hostname is ${s.hostname}";

}