rjweb-server
Version:
Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS
68 lines (67 loc) • 1.58 kB
JavaScript
import { deepParseOptions } from "rjutils-collection";
import size from "./size";
function parseOptions(provided) {
return deepParseOptions({
httpCompression: {
enabled: true,
maxSize: size(100).mb(),
disabledAlgorithms: []
},
wsCompression: {
enabled: true
},
body: {
enabled: true,
maxSize: size(5).mb(),
message: "Payload too large"
},
message: {
enabled: true,
maxSize: size(500).kb(),
message: "Payload too large"
},
logging: {
error: true,
warn: true,
debug: false
},
ssl: {
enabled: false,
ciphers: "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384",
keyFile: "/ssl/key/path",
certFile: "/ssl/cert/path",
caFile: "",
dhParamFile: ""
},
dashboard: {
enabled: false,
path: "/rjweb-dashboard",
password: "",
updateInterval: 1500
},
performance: {
eTag: true,
lastModified: true,
decompressBodies: true
},
proxy: {
enabled: false,
header: "x-forwarded-for",
forceProxy: false,
credentials: {
authenticate: true,
username: "proxy",
password: "proxy"
}
},
bind: "0.0.0.0",
cors: false,
port: 0,
cache: true,
cacheLimit: 25e3,
poweredBy: true
}, provided);
}
export {
parseOptions as default
};