@uniorganization/uni-lib 1.0.21 → 1.0.25
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.
|
@@ -10,28 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.versionChecker = void 0;
|
|
13
|
-
const
|
|
14
|
-
const
|
|
13
|
+
const fs = require("fs/promises");
|
|
14
|
+
const path = require("path");
|
|
15
15
|
function versionChecker(req, res, next) {
|
|
16
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
const
|
|
18
|
-
type: 'postgres',
|
|
19
|
-
host: '127.0.0.1',
|
|
20
|
-
port: 5432,
|
|
21
|
-
username: 'postgres',
|
|
22
|
-
password: 'postgres',
|
|
23
|
-
database: 'uni',
|
|
24
|
-
ssl: false,
|
|
25
|
-
schema: 'stm',
|
|
26
|
-
entities: [config_entity_1.Config],
|
|
27
|
-
synchronize: false,
|
|
28
|
-
});
|
|
29
|
-
const { value: version } = yield connection
|
|
30
|
-
.getRepository(config_entity_1.Config)
|
|
31
|
-
.createQueryBuilder('config')
|
|
32
|
-
.where('config.key = :configKey', { configKey: 'app.version' })
|
|
33
|
-
.getOne();
|
|
34
|
-
yield connection.close();
|
|
17
|
+
const version = (yield fs.readFile(path.join(process.cwd(), 'app-version.txt'))).toString();
|
|
35
18
|
if (req.headers['app-version'] !== version)
|
|
36
19
|
return res.status(409).json({
|
|
37
20
|
message: `You need to update the application version to ${version}`,
|