feat(xo-server): make http.listen config an object
It remains compatible with previous configurations. It now aligns with xo-proxy's config and is easier to overload with other config files.
This commit is contained in:
parent
dbb9e4d60f
commit
75a9799e96
@ -29,5 +29,6 @@
|
|||||||
|
|
||||||
- @xen-orchestra/fs minor
|
- @xen-orchestra/fs minor
|
||||||
- vhd-lib major
|
- vhd-lib major
|
||||||
|
- xo-server minor
|
||||||
|
|
||||||
<!--packages-end-->
|
<!--packages-end-->
|
||||||
|
@ -105,7 +105,15 @@ threshold = 1000
|
|||||||
#[http.helmet.hsts]
|
#[http.helmet.hsts]
|
||||||
#includeSubDomains = false
|
#includeSubDomains = false
|
||||||
|
|
||||||
[[http.listen]]
|
# Each `http.listen.<name>` entry defines a specific listening configuration for
|
||||||
|
# the HTTP server.
|
||||||
|
#
|
||||||
|
# `<name>` can be freely choosen.
|
||||||
|
#
|
||||||
|
# Historically, `http.listen` was an array with the first config for HTTP and
|
||||||
|
# the second for HTTPS. To avoid breaking existing user configs, this convention
|
||||||
|
# is kept.
|
||||||
|
[http.listen.0]
|
||||||
port = 80
|
port = 80
|
||||||
|
|
||||||
# These options are applied to all listen entries.
|
# These options are applied to all listen entries.
|
||||||
|
@ -11,7 +11,6 @@ import has from 'lodash/has.js'
|
|||||||
import helmet from 'helmet'
|
import helmet from 'helmet'
|
||||||
import httpProxy from 'http-proxy'
|
import httpProxy from 'http-proxy'
|
||||||
import includes from 'lodash/includes.js'
|
import includes from 'lodash/includes.js'
|
||||||
import map from 'lodash/map.js'
|
|
||||||
import memoryStoreFactory from 'memorystore'
|
import memoryStoreFactory from 'memorystore'
|
||||||
import merge from 'lodash/merge.js'
|
import merge from 'lodash/merge.js'
|
||||||
import ms from 'ms'
|
import ms from 'ms'
|
||||||
@ -474,8 +473,8 @@ async function makeWebServerListen(
|
|||||||
|
|
||||||
async function createWebServer({ listen, listenOptions }) {
|
async function createWebServer({ listen, listenOptions }) {
|
||||||
const webServer = stoppable(new WebServer())
|
const webServer = stoppable(new WebServer())
|
||||||
await Promise.all(
|
await asyncMap(Object.entries(listen), ([configKey, opts]) =>
|
||||||
map(listen, (opts, configKey) => makeWebServerListen(webServer, { ...listenOptions, ...opts, configKey }))
|
makeWebServerListen(webServer, { ...listenOptions, ...opts, configKey })
|
||||||
)
|
)
|
||||||
|
|
||||||
return webServer
|
return webServer
|
||||||
|
Loading…
Reference in New Issue
Block a user