Skip to content

Commit d17ebef

Browse files
committed
fix: added conditional to usage of @ladjs/store-ip-address
1 parent b634a77 commit d17ebef

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

index.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,15 @@ class API {
3636
};
3737

3838
const { logger } = this.config;
39-
const storeIPAddress = new StoreIPAddress({
40-
logger,
41-
...this.config.storeIPAddress
42-
});
39+
40+
let storeIPAddress = false;
41+
42+
if (this.config.storeIPAddress)
43+
storeIPAddress = new StoreIPAddress({
44+
logger,
45+
...this.config.storeIPAddress
46+
});
47+
4348
const cabin = new Cabin({
4449
logger,
4550
...this.config.cabin
@@ -143,7 +148,7 @@ class API {
143148
}
144149

145150
// store the user's last ip address in the background
146-
app.use(storeIPAddress.middleware);
151+
if (storeIPAddress) app.use(storeIPAddress.middleware);
147152

148153
// allow before hooks to get setup
149154
if (_.isFunction(this.config.hookBeforeRoutes))

0 commit comments

Comments
 (0)