account-lookup-service 17.8.0-snapshot.10 → 17.8.0-snapshot.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/server.js +16 -5
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "account-lookup-service",
|
3
3
|
"description": "Account Lookup Service is used to validate Party and Participant lookups.",
|
4
|
-
"version": "17.8.0-snapshot.
|
4
|
+
"version": "17.8.0-snapshot.11",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"author": "ModusBox",
|
7
7
|
"contributors": [
|
@@ -106,7 +106,7 @@
|
|
106
106
|
"ajv-keywords": "5.1.0",
|
107
107
|
"blipp": "4.0.2",
|
108
108
|
"commander": "13.1.0",
|
109
|
-
"cron": "4.1.
|
109
|
+
"cron": "4.1.3",
|
110
110
|
"fast-safe-stringify": "^2.1.1",
|
111
111
|
"hapi-auth-bearer-token": "8.0.0",
|
112
112
|
"joi": "17.13.3",
|
package/src/server.js
CHANGED
@@ -45,7 +45,18 @@ const OracleEndpointCache = require('./models/oracle/oracleEndpointCached')
|
|
45
45
|
const Handlers = require('./handlers/register')
|
46
46
|
|
47
47
|
const connectDatabase = async (dbConfig) => {
|
48
|
-
|
48
|
+
await Db.connect(dbConfig)
|
49
|
+
logger.info('Database connected')
|
50
|
+
}
|
51
|
+
|
52
|
+
const initOpenApiBackend = async ({ isAdmin }) => {
|
53
|
+
const OpenAPISpecPath = Util.pathForInterface({ isAdmin, isMockInterface: false })
|
54
|
+
const apiHandlers = isAdmin
|
55
|
+
? APIHandlers.AdminHandlers
|
56
|
+
: APIHandlers.ApiHandlers
|
57
|
+
const api = await OpenapiBackend.initialise(OpenAPISpecPath, apiHandlers)
|
58
|
+
logger.verbose('OpenAPI Backend initialized', { isAdmin })
|
59
|
+
return api
|
49
60
|
}
|
50
61
|
|
51
62
|
const migrate = async () => {
|
@@ -132,8 +143,7 @@ const initializeApi = async (appConfig) => {
|
|
132
143
|
initializeInstrumentation(INSTRUMENTATION_METRICS_CONFIG)
|
133
144
|
}
|
134
145
|
await connectDatabase(DATABASE)
|
135
|
-
const
|
136
|
-
const api = await OpenapiBackend.initialise(OpenAPISpecPath, APIHandlers.ApiHandlers)
|
146
|
+
const api = await initOpenApiBackend({ isAdmin: false })
|
137
147
|
|
138
148
|
await Promise.all([
|
139
149
|
Endpoints.initializeCache(CENTRAL_SHARED_ENDPOINT_CACHE_CONFIG, Util.hubNameConfig),
|
@@ -142,6 +152,7 @@ const initializeApi = async (appConfig) => {
|
|
142
152
|
OracleEndpointCache.initialize(),
|
143
153
|
Cache.initCache()
|
144
154
|
])
|
155
|
+
logger.verbose('all caches initialized')
|
145
156
|
|
146
157
|
return createServer(API_PORT, api, Routes.APIRoutes(api), false, PROXY_CACHE_CONFIG)
|
147
158
|
}
|
@@ -161,8 +172,8 @@ const initializeAdmin = async (appConfig) => {
|
|
161
172
|
}
|
162
173
|
await connectDatabase(DATABASE)
|
163
174
|
RUN_MIGRATIONS && await migrate()
|
164
|
-
const
|
165
|
-
|
175
|
+
const api = await initOpenApiBackend({ isAdmin: true })
|
176
|
+
|
166
177
|
await Promise.all([
|
167
178
|
OracleEndpointCache.initialize(),
|
168
179
|
Cache.initCache()
|