You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
426 B
JavaScript
21 lines
426 B
JavaScript
"use strict";
|
|
|
|
const url = require("url");
|
|
const { validateOptions, required, isString } = require("validatem");
|
|
|
|
module.exports = function postgresqlSocketUrl({ socketPath, database } = {}) {
|
|
validateOptions(arguments, {
|
|
socketPath: [ required, isString ],
|
|
database: [ required, isString ]
|
|
});
|
|
|
|
return url.format({
|
|
protocol: "socket",
|
|
slashes: false,
|
|
pathname: socketPath,
|
|
query: {
|
|
db: database
|
|
}
|
|
});
|
|
};
|