all repos — dbee @ 6bc91d7e907992c8beeea717c98a830b183af97a

Move PostgreSQL backups using S3

libs/psql/getConfig.js (view raw)

 1const chalk = require("chalk");
 2const getConfig = require("../../libs/config/get");
 3
 4const defaultConfig = {
 5  host: "localhost",
 6  username: "postgres",
 7  password: null,
 8  useSSL: false,
 9  port: 5432,
10};
11
12const getPsqlConfig = psqlName => {
13  if (psqlName === "localhost") {
14    console.log(chalk.grey("Use default PSQL config"));
15    return defaultConfig;
16  }
17  const config = getConfig(`psql.${psqlName}`);
18  if (!config) throw new Error(`No config found for PSQL server '${psqlName}'`);
19  return config;
20};
21
22module.exports = getPsqlConfig;