Skip to content

Commit

Permalink
Document all the environment variables supported by Castor
Browse files Browse the repository at this point in the history
  • Loading branch information
pyrech committed Nov 27, 2024
1 parent dc38be8 commit 72de10c
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
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)

0 comments on commit 72de10c

Please sign in to comment.