Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document all the environment variables supported by Castor #584

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
* Add support for disabling stubs generation (with `CASTOR_GENERATE_STUBS=0`
environment variable)

### Documentation

* Document all the environment variables supported by Castor

## 0.21.0 (2024-11-19)

### Features
Expand Down
15 changes: 12 additions & 3 deletions doc/going-further/helpers/cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,24 @@ function foo()
}
```

By default, it caches items on the filesystem, in the `<home directory>/.cache/castor`
directory. The function also prefix the key with a hash of the project directory
to avoid any collision between different Castor projects.
The `cache()` function prefix the key with a hash of the project directory to
avoid any collision between different Castor projects.

> [!NOTE]
> Under the hood, Castor use Symfony Cache component. You can check the
> [Symfony documentation](https://symfony.com/doc/current/components/cache.html)
> for more information about this component and how to use it.

## Cache location on the filesystem

By default, Castor caches items on the filesystem, in the `<home directory>/.cache/castor`
directory. If you want to change the cache directory, you can set the `CASTOR_CACHE_DIR`
environment variable.

```shell
CASTOR_CACHE_DIR=/tmp/castor-cache castor foo
```

## The `get_cache()` function

If you need to have a full control on the cache, you can access the
Expand Down
16 changes: 16 additions & 0 deletions doc/going-further/helpers/console-and-io.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,19 @@ In some cases there may be no task to return, if an event listener is triggered
before the task or during a context initialization for example. In this case,
`task()` will throw an exception. You can use the optional parameter to allow
`task(true)` to return `null` in this case.

## Experimental section output

When running commands in parallel, output can be mixed and hard to read. Castor
provides an experimental feature to display the output of each command in a
dedicated section of the console.

This feature is disabled by default and can be enabled by setting the
`CASTOR_USE_SECTION` environment variable to `true`.

```shell
CASTOR_USE_SECTION=true castor task-running-commands-in-parallel
```

> [!WARNING]
> This feature is experimental and may be removed or changed in the future.
10 changes: 10 additions & 0 deletions doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,13 @@ Castor provides the following attributes to register tasks, listener, etc:
- [`AsRawTokens`](getting-started/arguments.md#arguments-without-configuration-nor-validation)
- [`AsSymfonyTask`](going-further/interacting-with-castor/symfony-task.md)
- [`AsTask`](getting-started/basic-usage.md)

## Environment variables

Castor supports the following environment variables:

- [`CASTOR_CACHE_DIR`](going-further/helpers/cache.md#cache-location-on-the-filesystem)
- [`CASTOR_CONTEXT`](getting-started/context.md#setting-a-default-context)
- [`CASTOR_GENERATE_STUBS`](installation.md#stubs)
- [`CASTOR_NO_REMOTE`](going-further/extending-castor/remote-imports.md#preventing-remote-imports)
- [`CASTOR_USE_SECTION`](going-further/helpers/console-and-io.md#experimental-section-output)