corebasic 1.0.94 → 1.0.96
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/libs/features.js +11 -1
- package/package.json +1 -1
package/libs/features.js
CHANGED
|
@@ -12,7 +12,7 @@ const getFeatureMethod = api => api.split(' ')[0].toLowerCase()
|
|
|
12
12
|
const getFeatureUrl = api => api.split(' ')[1]
|
|
13
13
|
const getFeature = name => features[name]
|
|
14
14
|
|
|
15
|
-
let SLYP_FEATURES_LIST = {}
|
|
15
|
+
let SLYP_FEATURES_LIST = process.env.FEATURES_JSON ? JSON.parse(process.env.FEATURES_JSON) : {}
|
|
16
16
|
let appId = Utils.uid()
|
|
17
17
|
let SERVICE_ADDRESS = process.env.APP_ENDPOINT || 'http://127.0.0.1:3000'
|
|
18
18
|
|
|
@@ -60,6 +60,16 @@ export const start = async (app, url, file) => {
|
|
|
60
60
|
features = await Utils.fileToJson(url, file)
|
|
61
61
|
await announce()
|
|
62
62
|
|
|
63
|
+
app.get('/features', async (req, res) => {
|
|
64
|
+
let exp_features = {}
|
|
65
|
+
for (let [key, {api}] of Object.entries(features))
|
|
66
|
+
exp_features[key] = {api, service: `${SERVICE_ADDRESS}`}
|
|
67
|
+
if (process.env.FEATURES_JSON) {
|
|
68
|
+
for (let key in SLYP_FEATURES_LIST)
|
|
69
|
+
SLYP_FEATURES_LIST[key].headers = {JWT: SERVICE_ACCESS_TOKEN, service: true}
|
|
70
|
+
}
|
|
71
|
+
res.json({ data: { ...SLYP_FEATURES_LIST, ...exp_features } })
|
|
72
|
+
})
|
|
63
73
|
|
|
64
74
|
// Registering handlers
|
|
65
75
|
for (let name in features) {
|