Compare View

switch
from
...
to
 
Commits (2)

Changes

Showing 2 changed files Inline Diff

api-server/router-config.js
1 "use strict"; 1 "use strict";
2 2
3 const express = require('express'); 3 const express = require('express');
4 const jsonQuery = require('json-query');
4 const jsonQuery = require('json-query'); 5
5 6 const config = require('../config');
6 const config = require('../config'); 7 const logger = require('../logger');
7 const logger = require('../logger'); 8 const matrix = require('../matrix');
8 const matrix = require('../matrix'); 9
9 10 const router = express.Router();
10 const router = express.Router(); 11 module.exports = router;
11 module.exports = router; 12
12 13 function getJsonConfig(req, res, next) {
13 function getJsonConfig(req, res, next) { 14 res.json(config);
14 res.json(config); 15 }
15 } 16
16 17 function getConfigElement(req, res, next) {
17 function getConfigElement(req, res, next) { 18 if (!req || !req.params || !req.params.key) {
18 if (!req || !req.params || !req.params.key) { 19 res.json(config);
20 return;
21 }
22
23 res.json(jsonQuery(rq.params.key, {config: config}));
19 res.json(config); 24 }
20 return; 25
21 } 26 router.get('/', getJsonConfig);
22 27 router.post('/', getJsonConfig);
23 res.json(jsonQuery(rq.params.key, {config: config})); 28 router.use('/get/:key', getConfigElement);
24 } 29
1 { 1 {
2 "name": "komodo-sdk", 2 "name": "komodo-sdk",
3 "version": "1.24.2", 3 "version": "1.24.3",
4 "description": "SDK for Komodo", 4 "description": "SDK for Komodo",
5 "main": "index.js", 5 "main": "index.js",
6 "scripts": { 6 "scripts": {
7 "test": "mocha", 7 "test": "mocha",
8 "postversion": "git push && git push --tags" 8 "postversion": "git push && git push --tags"
9 }, 9 },
10 "repository": { 10 "repository": {
11 "type": "git", 11 "type": "git",
12 "url": "git@gitlab.kodesumber.com:komodo/komodo-sdk.git" 12 "url": "git@gitlab.kodesumber.com:komodo/komodo-sdk.git"
13 }, 13 },
14 "keywords": [ 14 "keywords": [
15 "ppob", 15 "ppob",
16 "payment", 16 "payment",
17 "komodo" 17 "komodo"
18 ], 18 ],
19 "author": "Adhidarma Hadiwinoto <gua@adhisimon.org>", 19 "author": "Adhidarma Hadiwinoto <gua@adhisimon.org>",
20 "license": "ISC", 20 "license": "ISC",
21 "dependencies": { 21 "dependencies": {
22 "basic-auth": "^2.0.0", 22 "basic-auth": "^2.0.0",
23 "body-parser": "^1.18.2", 23 "body-parser": "^1.18.2",
24 "express": "^4.16.3", 24 "express": "^4.16.3",
25 "express-session": "^1.15.6", 25 "express-session": "^1.15.6",
26 "json-query": "^2.2.2",
26 "json-query": "^2.2.2", 27 "lru-cache": "^4.1.1",
27 "lru-cache": "^4.1.1", 28 "macaddress": "^0.2.8",
28 "macaddress": "^0.2.8", 29 "moment": "^2.19.1",
29 "moment": "^2.19.1", 30 "node-machine-id": "^1.1.10",
30 "node-machine-id": "^1.1.10", 31 "node-natural-sort": "^0.8.6",
31 "node-natural-sort": "^0.8.6", 32 "numeral": "^2.0.6",
32 "numeral": "^2.0.6", 33 "nunjucks": "^3.0.1",
33 "nunjucks": "^3.0.1", 34 "redis": "^2.8.0",
34 "redis": "^2.8.0", 35 "request": "^2.81.0",
35 "request": "^2.81.0", 36 "sha1": "^1.1.1",
36 "sha1": "^1.1.1", 37 "simple-git": "^1.80.1",
37 "simple-git": "^1.80.1", 38 "strftime": "^0.10.0",
38 "strftime": "^0.10.0", 39 "uniqid": "^4.1.1",
39 "uniqid": "^4.1.1", 40 "uuid": "^3.1.0",
40 "uuid": "^3.1.0", 41 "winston": "^2.3.1",
41 "winston": "^2.3.1", 42 "winston-circular-buffer": "^1.0.0",
42 "winston-circular-buffer": "^1.0.0", 43 "winston-daily-rotate-file": "^1.4.6"
43 "winston-daily-rotate-file": "^1.4.6" 44 }
44 } 45 }
45 } 46