From 72de10cd8f37d467b6d4bfe1114dc86ab7012e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFck=20Piera?= Date: Wed, 27 Nov 2024 21:46:08 +0100 Subject: [PATCH] Document all the environment variables supported by Castor --- CHANGELOG.md | 4 ++++ doc/going-further/helpers/cache.md | 15 ++++++++++++--- doc/going-further/helpers/console-and-io.md | 16 ++++++++++++++++ doc/reference.md | 10 ++++++++++ 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba57402f..fbe3df3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/doc/going-further/helpers/cache.md b/doc/going-further/helpers/cache.md index c9dd316c..94d9a8c7 100644 --- a/doc/going-further/helpers/cache.md +++ b/doc/going-further/helpers/cache.md @@ -28,15 +28,24 @@ function foo() } ``` -By default, it caches items on the filesystem, in the `/.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 `/.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 diff --git a/doc/going-further/helpers/console-and-io.md b/doc/going-further/helpers/console-and-io.md index e2e1fb18..8fa76f31 100644 --- a/doc/going-further/helpers/console-and-io.md +++ b/doc/going-further/helpers/console-and-io.md @@ -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. diff --git a/doc/reference.md b/doc/reference.md index 7f7c35f6..b2c44c06 100644 --- a/doc/reference.md +++ b/doc/reference.md @@ -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)