Read the site environment
get_site_environment
Returns the lines of a site's environment, how its last build went and which build its machines use.
A site's environment is the list of lines Modulify adds on top of its own base, Node.js 22 on Debian 12, when it builds the machines for the preview, the live site and its publish build. A packages line installs Debian 12 system packages, and a command line runs one setup command while the machine image is built.
The answer holds:
| Field | What it holds |
|---|---|
Allowed |
Whether the site can change its environment. It is false on the Free plan, and when the environment is turned off for the site. |
Lines |
The lines saved last. |
LinesHash |
A fingerprint of Lines. Pass it to update_site_environment as linesHash. |
Latest |
That save and its Status: queued, building, ready, failed, canceled or superseded. A failed save also carries Failure, Error, Failed_Line and Excerpt, the last lines the failing line printed. Failure is preview-start when the build worked but the preview did not start on it. |
Active |
The build the machines use, or null for the standard environment. |
Building |
Whether a build is waiting or running. |
History |
The last saves, newest first. |
Live |
Published, and UpToDate when the live site already runs the newest environment that works. |
Limits |
How many lines the site can hold, how many saves it gets a day and how many it has used today. |
Dockerfile |
The Dockerfile Modulify builds the preview from the saved lines, the same file View as Dockerfile shows. It is empty on the standard environment. |
While Building is true, read it again every 10 to 15 seconds to follow the build until Latest.Status is no longer queued or building. The preview moves to a new build once it works and only if it starts on it; otherwise it keeps the environment it had. The live site uses a new build from its next publish, and a publish started while a build runs waits for it. See Environment.
Inputs
| Input | Type | Required | Description |
|---|---|---|---|
projectId |
string | Yes | The site id. |