function fastly_get_vcl in Fastly 7.2
Returns the API object.
The key and service id can be overriden for validation reasons.
1 call to fastly_get_vcl()
- fastly_vcl_upload_form_submit in ./
fastly.admin.inc - Implements hook_form_submit().
File
- ./
fastly.module, line 193 - Fastly module.
Code
function fastly_get_vcl($api_key = '', $service_id = '') {
$vcl_dir = $vcl_dir = drupal_get_path('module', 'fastly') . '/vcl_snippets';
$data = [
'vcl' => [
[
'vcl_dir' => $vcl_dir,
'type' => 'recv',
],
[
'vcl_dir' => $vcl_dir,
'type' => 'deliver',
],
[
'vcl_dir' => $vcl_dir,
'type' => 'error',
],
[
'vcl_dir' => $vcl_dir,
'type' => 'fetch',
],
],
'condition' => [
[
'name' => 'drupalmodule_request',
'statement' => 'req.http.x-pass == "1"',
'type' => 'REQUEST',
'priority' => 90,
],
],
'setting' => [
[
'name' => 'drupalmodule_setting',
'action' => 'pass',
'request_condition' => 'drupalmodule_request',
],
],
];
if (empty($api_key)) {
$api_key = variable_get('fastly_api_key', '');
}
if (empty($service_id)) {
$service_id = variable_get('fastly_service_id', '');
}
return new Vcl($data, $api_key, $service_id);
}