Create a consume.php
file under your /config
directory with the following options available to you. You can also use multi-environment options to change these per environment.
The below shows the defaults already used by Consume, so you don't need to add these options unless you want to modify the values.
<?php
return [
'*' => [
'pluginName' => 'Consume',
'enableCache' => true,
'cacheDuration' => 'PT1H',
]
];
pluginName
- If you wish to customise the plugin name.enableCache
- Whether to enable the cache for data.cacheDuration
- When the cache is enabled, how long data is cached for. Accepts a Date Interval (opens new window) or a number of seconds.Supply your client configurations as per the below. The key
for each item should be the client handle
. Do note that this only allows overriding existing clients and their settings, and you can't define clients purely in the configuration file.
return [
'clients' => [
'facebook' => [
'enabled' => true,
'clientId' => 'xxxxxxxxxxxx',
'clientSecret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
],
'myCustomClient' => [
'url' => 'https://my-app.test/some/path',
// Add any query params for the client
'queryParams' => [
'limit' => '10',
],
// Add any headers for the client
'headers' => [
'api-key' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
],
// If your client needs to use HTTP Basic Auth...
'httpAuth' => [
'username' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'password' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
],
],
],
];
You can also manage configuration settings through the Control Panel by visiting Settings → Consume.