powr-sdk-api 2.3.1 → 2.3.3
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/dist/config.js +6 -22
- package/dist/logger/index.js +1 -3
- package/dist/middleware/jwtToken.js +2 -4
- package/package.json +1 -1
package/dist/config.js
CHANGED
|
@@ -1,25 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
mongoUri: process.env.POWR_DB_URI,
|
|
9
|
-
projectId: process.env.PROJECT_ID,
|
|
10
|
-
jwtToken: process.env.JWT_TOKEN,
|
|
11
|
-
storageBucket: process.env.STORAGE_BUCKET
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// Validate required configs
|
|
15
|
-
if (!config.mongoUri) {
|
|
16
|
-
throw new Error('POWR_DB_URI environment variable is required');
|
|
17
|
-
}
|
|
18
|
-
if (!config.projectId) {
|
|
19
|
-
throw new Error('PROJECT_ID environment variable is required');
|
|
20
|
-
}
|
|
21
|
-
return config;
|
|
3
|
+
const config = {
|
|
4
|
+
mongoUri: process.env.POWR_DB_URI,
|
|
5
|
+
projectId: process.env.PROJECT_ID,
|
|
6
|
+
jwtToken: process.env.JWT_TOKEN,
|
|
7
|
+
storageBucket: process.env.STORAGE_BUCKET
|
|
22
8
|
};
|
|
23
|
-
module.exports =
|
|
24
|
-
getConfig
|
|
25
|
-
};
|
|
9
|
+
module.exports = config;
|
package/dist/logger/index.js
CHANGED
|
@@ -4,9 +4,7 @@ const jwt = require('jsonwebtoken');
|
|
|
4
4
|
const {
|
|
5
5
|
ObjectId
|
|
6
6
|
} = require('mongodb');
|
|
7
|
-
const
|
|
8
|
-
config
|
|
9
|
-
} = require('../config');
|
|
7
|
+
const config = require('../config');
|
|
10
8
|
const generateJWTToken = user => {
|
|
11
9
|
return jwt.sign({
|
|
12
10
|
userId: user._id
|
|
@@ -49,7 +47,7 @@ const verifyToken = async (req, res, next) => {
|
|
|
49
47
|
console.error("Error in auth middleware:", error);
|
|
50
48
|
return res.status(401).json({
|
|
51
49
|
success: false,
|
|
52
|
-
message:
|
|
50
|
+
message: error.message
|
|
53
51
|
});
|
|
54
52
|
}
|
|
55
53
|
};
|