forked from linkedpipes/dcat-ap-forms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuration.js
113 lines (108 loc) · 3.06 KB
/
configuration.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
const defaultConfiguration = {
"port": 8057,
"nkod_databox": "abc123",
"solr_media_types": "http://localhost:8983/solr/iana-media-types",
"solr_dataset_theme": "http://localhost:8983/solr/dataset-themes",
"solr_file_type": "http://localhost:8983/solr/mdr-file-type",
"solr_frequency": "http://localhost:8983/solr/frequencies",
"solr_ruian": "http://localhost:8983/solr/ruian",
"solr_themes": "http://localhost:8983/solr/eurovoc",
"solr_continents": "http://localhost:8983/solr/continents",
"solr_countries": "http://localhost:8983/solr/countries",
"solr_places": "http://localhost:8983/solr/places",
"solr_hvd_categories": "http://localhost:8983/solr/hvd-categories",
"dereference_proxy": "",
"head": [
{
"$type": "meta",
"charset": "UTF-8",
}, {
"$type": "meta",
"name": "viewport",
"content": "width=device-width,initial-scale=1.0",
}, {
"$type": "meta",
"name": "theme-color",
"content": "#057fa5",
}, {
"$type": "meta",
"name": "msapplication-TileColor",
"content": "#057fa5",
}, {
"$type": "meta",
"name": "msapplication-config",
"content": "./assets/icons/browserconfig.xml",
}, {
"$type": "link",
"rel": "apple-touch-icon",
"sizes": "180x180",
"href": "./assets/icons/apple-touch-icon.png",
}, {
"$type": "link",
"rel": "icon",
"type": "image/png",
"sizes": "32x32",
"href": "./assets/icons/favicon-32x32.png",
}, {
"$type": "link",
"rel": "icon",
"type": "image/png",
"sizes": "16x16",
"href": "./assets/icons/favicon-16x16.png",
}, {
"$type": "link",
"rel": "manifest",
"href": "./assets/manifest.json",
}, {
"$type": "link",
"rel": "mask-icon",
"href": "./assets/icons/safari-pinned-tab.svg",
"color": "#5bbad5",
}, {
"$type": "link",
"rel": "shortcut icon",
"href": "./assets/icons/favicon.ico",
}, {
"$type": "link",
"href": "https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons",
"rel": "stylesheet",
},
],
"resources_url_prefix": "./",
};
(function initialize() {
const configurationPath = readProperty(
"configFileLocation", "dcatApFormsConfig");
let userConfiguration = {};
if (configurationPath) {
console.log("Loading configuration from: ", configurationPath);
userConfiguration = require(configurationPath);
}
module.exports = {
...defaultConfiguration,
...userConfiguration,
};
})();
function readProperty(argName, envName) {
const argument = readProgramArgument(argName);
if (argument !== undefined) {
return argument;
} else if (process.env[envName] !== undefined) {
return process.env[envName];
} else {
return undefined;
}
}
function readProgramArgument(name) {
let output = undefined;
process.argv.forEach((value) => {
const line = value.split("=");
if (line.length !== 2) {
return;
}
if (line[0] === name) {
output = line[1];
}
});
return output;
}