Files
metrics/source/app/web/settings.example.json
2022-07-29 16:59:57 -04:00

60 lines
4.9 KiB
JSON
Generated

{
"//": "Example of configuration for metrics web instance",
"//": "====================================================================",
"token": "GITHUB API TOKEN", "//": "GitHub Personal Token (required)",
"modes": ["embed", "insights"], "//": "Web instance enabled modes",
"restricted": [], "//": "Authorized users (empty to disable)",
"maxusers": 0, "//": "Maximum users, (0 to disable)",
"cached": 3600000, "//": "Cache time rendered metrics (0 to disable)",
"ratelimiter": null, "//": "Rate limiter (see express-rate-limit documentation)",
"port": 3000, "//": "Listening port",
"optimize": true, "//": "SVG optimization",
"debug": false, "//": "Debug logs",
"debug.headless": false, "//": "Debug puppeteer process",
"mocked": false, "//": "Use mocked data instead of live APIs (use 'force' to use mocked token even if real token are defined)",
"repositories": 100, "//": "Number of repositories to use",
"padding": ["0", "8 + 11%"], "//": "Image padding (default)",
"outputs": ["svg", "png", "json"], "//": "Image output formats (empty to enable all)",
"hosted": {
"by": "", "//": "Web instance host (displayed in footer)",
"link": "", "//": "Web instance host link (displayed in footer)"
},
"control":{
"token": null, "//": "Control token (can be used by external services to perform actions on instance, such as stopping it for redeploys)"
},
"community": {
"templates": [], "//": "Additional community templates to setup"
},
"templates": {
"default": "classic", "//": "Default template",
"enabled": [], "//": "Enabled templates (empty to enable all)"
},
"extras": {
"default": false, "//": "Default extras state (advised to let 'false' unless in debug mode)",
"presets": false, "//": "Allow use of 'config.presets' option",
"features": false, "//": "Enable extra features (advised to let 'false' on web instances), see below for supported features",
"//": "________________________________________________________________________",
"//": "metrics.setup.community.templates | Allow community templates download",
"//": "metrics.setup.community.presets | Allow community presets usage",
"//": "metrics.api.github.overuse | Allow GitHub API intensive requests",
"//": "metrics.api.* | Allow use of external API requests",
"//": "metrics.cpu.overuse | Allow CPU intensive requests",
"//": "metrics.run.tempdir | Allow access to temporary directory (I/O operations may be performed)",
"//": "metrics.run.git | Allow to run git",
"//": "metrics.run.licensed | Allow to run licensed",
"//": "metrics.run.user.cmd | Allow to run ANY command by user (USE WITH CAUTION!)",
"//": "metrics.run.puppeteer.scrapping | Allow to run puppeteer to scrape data",
"//": "metrics.run.puppeteer.user.css | Allow to run CSS by user during puppeteer render",
"//": "metrics.run.puppeteer.user.js | Allow to run JavaScript by user during puppeteer render",
"//": "metrics.npm.optional.* | Allow use of specified dependency"
},
"plugins.default": false, "//": "Default plugin state (advised to let 'false' unless in debug mode)",
"plugins": { "//": "Global plugin configuration",
<% for (const name of Object.keys(plugins).filter(v => !["base", "core"].includes(v))) { -%>
"<%= name %>":{
<%- JSON.stringify(Object.fromEntries(Object.entries(plugins[name].inputs).filter(([key, {type}]) => (type === "token")&&(!key.includes("_"))).map(([key, {description:value}]) => [key.replace(new RegExp(`^plugin_${name}_`), ""), value.split("\n")[0].trim()])), null, 6).replace(/^[{]/gm, "").replace(/^\s*[}]$/gm, "").replace(/(?:([a-z0-9.]+)(?=[.]))(.*)": "/gm, (_, k, r) => `${k}${r}${'": null,'.padEnd(27 - (k.length ? k.length+1 : 0))} "//": "`).replace(/"$/gm, '",').trimStart().replace(/\n$/gm, "\n ") %>"enabled": false, "//": "<%= plugins[name].inputs[`plugin_${name}`].description.trim() %>"
},
<% } %>"//": ""
}
}