/** @return EnvironmentResource */
public function expose(
string $project,
string $environment,
?string $product = null,
int|float|null $timeout = null,
): arrayTurns on public exposure by posting ['exposed' => true] for you. A branded public URL then serves the variables of that environment as ciphertext, so anyone with the link still needs the workspace passphrase or key to read a value. Nothing is decrypted server-side.
Two independent flags have to line up or the call is refused. The workspace needs virtualEnvsEnabled, which you set with $envless->workspace->update(), and the product that owns the project must not be private. A private product fails with environment.expose_private_product and can never be exposed, so move the project or unset privacy first.
Example
use Envless\Envless;
$envless = new Envless();
$envless->workspace->update(['virtualEnvsEnabled' => true]);
$environment = $envless->environments->expose('api', 'production');
echo $environment['exposed'] ? 'exposed' : 'not exposed', PHP_EOL;Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
$project | string | Yes | Project slug or uniqueId that owns the environment. |
$environment | string | Yes | Slug of the environment to expose; ids are not accepted. |
$product | string | No | Product slug that disambiguates an ambiguous project slug. |
$timeout | int|float | No | Seconds each attempt of this call may take, the response body included, before it throws Envless\Exception\NetworkException with isTimeout() true. Overrides the client's timeout for this call, and 0 turns the limit off. |
Returns
EnvironmentResource with exposed true, plus updatedAt.
Worth knowing
- The two-flag opt-in is deliberate, so a single accidental toggle cannot publish a feed.
- Anything you would not hand out as ciphertext does not belong in an exposed environment.
Required scopes
environments:write
Underlying endpoint
POST /projects/{slug}/environments/{environmentSlug}/expose
Request and response schema, every error code, and a live playground.
In TypeScript
envless.environments.expose()
The same method in @goenvless/sdk, with the same request, retries and errors.