This repository was archived by the owner on May 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprovision.php
More file actions
112 lines (93 loc) · 3.11 KB
/
provision.php
File metadata and controls
112 lines (93 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
use BCLib\BCBento\ArticlesService;
use BCLib\BCBento\CatalogService;
use BCLib\BCBento\DPLAService;
use BCLib\BCBento\FAQService;
use BCLib\BCBento\GuidesService;
use BCLib\BCBento\LibrariansService;
use BCLib\BCBento\SpringshareService;
use BCLib\BCBento\TypeaheadService;
use BCLib\BCBento\VideoService;
use BCLib\BCBento\VideoThumbClient;
use BCLib\PrimoClient\PrimoClient;
use BCLib\PrimoServices\PrimoServices;
use BCLib\PrimoServices\QueryBuilder;
use Doctrine\Common\Cache\RedisCache;
$app->primo = function () use ($app) {
return new PrimoServices(
$app->config('PRIMO_HOST'), $app->config('PRIMO_INSTITUTION'), $app->redis, '4.9'
);
};
$app->primo_client = function () use ($app) {
return PrimoClient::build(
$app->config('EXL_API_GATEWAY'),
$app->config('PRIMO_APIKEY'),
$app->config('PRIMO_DEFAULT_TAB'),
$app->config('PRIMO_DEFAULT_VID'),
$app->config('PRIMO_DEFAULT_SCOPE')
);
};
$app->qb = function () use ($app) {
return new QueryBuilder($app->config('PRIMO_INSTITUTION'));
};
$app->redis = function () use ($app) {
$redis = new Redis();
$redis->connect($app->config('REDIS_HOST'));
$cache = new RedisCache();
$cache->setRedis($redis);
return $cache;
};
$app->elasticsearch = function () use ($app) {
$hosts = [$app->config('ELASTICSEARCH_HOST')];
return Elasticsearch\ClientBuilder::create()->setHosts($hosts)->build();
};
$app->typeahead = function () use ($app) {
return new TypeaheadService($app->elasticsearch);
};
$app->articles = function () use ($app) {
return new ArticlesService($app->primo, $app->qb, 'pci_only', 'pci');
};
$app->catalog = function () use ($app) {
return new CatalogService($app->primo, $app->qb, $app->worldcat);
};
$app->new_catalog = function () use ($app) {
return new \BCLib\BCBento\NewCatalogService($app->primo_client);
};
$app->website = function () use ($app) {
return new \BCLib\BCBento\WebsiteService($app->elasticsearch, $app->config('ELASTICSEARCH_VERSION'));
};
$app->guides = function () use ($app) {
return new GuidesService(
$app->elasticsearch, $app->config('ELASTICSEARCH_VERSION')
);
};
$app->librarians = function () use ($app) {
return new LibrariansService(
$app->elasticsearch, $app->config('ELASTICSEARCH_VERSION')
);
};
$app->dpla = function () use ($app) {
require_once __DIR__.'/vendor/3ft9/dpla/tfn/DPLA.php';
return new DPLAService(new \TFN\DPLA($app->config('DPLA_KEY')));
};
$app->worldcat = function () use ($app) {
return new \BCLib\BCBento\WorldCatService(
$app->config('WORLDCAT_KEY'),
$app->config('WORLDCAT_SECRET'),
$app->config('WORLDCAT_INST_NUM'),
$app->config('WORLDCAT_INST_CODE'),
$app->redis
);
};
$app->springshare = function () {
return new SpringshareService();
};
$app->faq = function () {
return new FAQService();
};
$app->video = function () use ($app) {
return new VideoService($app->primo, $app->qb, $app->video_thumbs);
};
$app->video_thumbs = function () use ($app) {
return new VideoThumbClient(new GuzzleHttp\Client(), $app->redis);
};