# Janitor tasks configuration files

You can optionally create Janitor tasks that hold some configuration in a separate configuration file, almost like [modules do](/version-1.x-beta/guide/modules-guide.md#modules-configuration-file).

To do so, set the `isConfigFile` property of your [JanitorTask](/version-1.x-beta/reference/core-classes/janitortask.md) class like this:

```php
<?php

namespace CherrycakeApp;
    
class JanitorTaskMoviesUpdateImdbRating extends \Cherrycake\Janitor\JanitorTask {
    protected $isConfigFile = true;
    ...
}
```

Janitor task configuration files must be stored in the `config` directory of your app, and must have a name that matches the task name, even with upper and lowercase characters. For example, the configuration file for our `JanitorTaskMoviesUpdateImdbRating` task must be called `/config/JanitorTaskMoviesUpdateImdbRating.config.php`

Janitor task configuration files must declare a hash array named in the syntax `$<JanitorTaskName>Config`. For example, this the configuration file for our `JanitorTaskMoviesUpdateImdbRating` task:

```php
<?php

namespace Cherrycake;

$JanitorTaskMoviesUpdateImdbRatingConfig = [
    "imdbAPIKey" => "mfu9873n94hosdaonfo3289"
];
```

The values you set in the [JanitorTask::config](/version-1.x-beta/reference/core-classes/janitortask/janitortask-properties.md#config) property of your task class will be used if no configuration file is used, or if the configuration key has not been set in the configuration file.

To get a configuration value from a [JanitorTask](/version-1.x-beta/reference/core-classes/janitortask.md), use the [JanitorTask::getConfig](/version-1.x-beta/reference/core-classes/janitortask/janitortask-methods.md#getconfig) method, for example:

```php
$this->getConfig("imdbAPIKey");
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cherrycake.tin.cat/version-1.x-beta/guide/janitor-guide/janitor-tasks-configuration-files.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
