Archived
1
0

Add str param to plural util

Adds a str param to common/util::plural for pluralizing a string.
Applies plural to entry.ts.
This commit is contained in:
G r e y
2020-08-09 00:06:18 -05:00
parent c78d164948
commit 6e27869c09
3 changed files with 8 additions and 3 deletions

View File

@ -11,6 +11,7 @@ import { Args, bindAddrFromAllSources, optionDescriptions, parse, readConfigFile
import { AuthType, HttpServer, HttpServerOptions } from "./http"
import { generateCertificate, hash, open, humanPath } from "./util"
import { ipcMain, wrap } from "./wrapper"
import { plural } from "../common/util"
process.on("uncaughtException", (error) => {
logger.error(`Uncaught exception: ${error.message}`)
@ -110,7 +111,7 @@ const main = async (args: Args, cliArgs: Args, configArgs: Args): Promise<void>
}
if (httpServer.proxyDomains.size > 0) {
logger.info(` - Proxying the following domain${httpServer.proxyDomains.size === 1 ? "" : "s"}:`)
logger.info(` - ${plural(httpServer.proxyDomains.size, "Proxying the following domain")}:`)
httpServer.proxyDomains.forEach((domain) => logger.info(` - *.${domain}`))
}

View File

@ -481,7 +481,7 @@ export class HttpServer {
this.proxyDomains = new Set((options.proxyDomains || []).map((d) => d.replace(/^\*\./, "")))
this.heart = new Heart(path.join(paths.data, "heartbeat"), async () => {
const connections = await this.getConnections()
logger.trace(`${connections} active connection${plural(connections)}`)
logger.trace(plural(connections, `${connections} active connection`))
return connections !== 0
})
this.protocol = this.options.cert ? "https" : "http"