Interface PostgresInstanceOptions

interface PostgresInstanceOptions {
    createPostgresUser: boolean;
    databaseDir: string;
    initdbFlags: string[];
    onError: ((messageOrError) => void);
    onLog: ((message) => void);
    overwriteDatabaseDir: boolean;
    password: string;
    persistent: boolean;
    port: number;
    postgresFlags: string[];
    user: string;
}

Properties

createPostgresUser: boolean

Postgres does not allow binaries to be run by root. In case you're running in root-only environments, such as Docker containers, you may need to create an extra user on your system in order to be able to call the binaries.

NOTE: This WILL irreversibly modify your host system. The effects are somewhat minor, but it's still recommend to only use this in Docker containers.

Defaults to false.

databaseDir: string

The location where the data should be persisted to. Defaults to: ./data/db

initdbFlags: string[]

Pass any additional flags to the initdb process. You can find all available flags here: https://www.postgresql.org/docs/current/app-initdb.html. Flags should be passed as a string array, e.g. ["--debug"] or ["--locale=en-GB"]

Defaults to []

onError: ((messageOrError) => void)

Pass in a custom error logging handler. This will catch and stderr results coming in from the postgres and initdb processes. Defaults to console.error

Type declaration

    • (messageOrError): void
    • Parameters

      • messageOrError: unknown

      Returns void

onLog: ((message) => void)

Pass in a custom logging handler. This will relay and console messages that are generated by the postgres and initdb processes. Defaults to console.log

Type declaration

    • (message): void
    • Parameters

      • message: string

      Returns void

overwriteDatabaseDir: boolean

Whether to overwrite the databaseDir if it exist. Defaults to false.

password: string

The password for logging into the Postgres database. Defaults to password

persistent: boolean

Whether all data should be left in place when the database is shut down. Defaults to true.

port: number

The port where the Postgres database should be listening. Defaults to a random port

postgresFlags: string[]

Pass any additional flags to the postgres process. You can find all available flags here: https://www.postgresql.org/docs/current/app-postgres.html. Flags should be passed as a string array, e.g. ["--debug"] or ["--locale=en-GB"].

Defaults to [].

user: string

The username for logging into the Postgres database. Defaults to postgres

Generated using TypeDoc