Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/typeorm/src/index.ts>ConnectionOptionsReader

Forked from https://github.com/typeorm/typeorm
Latest
class ConnectionOptionsReader
Re-export
import { ConnectionOptionsReader } from "https://deno.land/x/typeorm@v0.2.23-rc10/src/index.ts";

Reads connection options from the ormconfig. Can read from multiple file extensions including env, json, js, xml and yml.

Constructors

new
ConnectionOptionsReader(options?: { root?: string; configName?: string; })

Properties

protected
readonly
baseConfigName: string

Gets configuration file name.

protected
readonly
baseDirectory: string

Gets directory where configuration file should be located.

protected
readonly
baseFilePath: string

Gets directory where configuration file should be located and configuration file name.

Methods

protected
load(): Promise<ConnectionOptions[] | undefined>

Loads all connection options from a configuration file.

todo: get in count NODE_ENV somehow

protected
loadJson(path: string): Promise<ConnectionOptions>
protected
normalizeConnectionOptions(connectionOptions: ConnectionOptions | ConnectionOptions[]): ConnectionOptions[]

Normalize connection options.

all(): Promise<ConnectionOptions[]>

Returns all connection options read from the ormconfig.

get(name: string): Promise<ConnectionOptions>

Gets a connection with a given name read from ormconfig. If connection with such name would not be found then it throw error.

has(name: string): Promise<boolean>

Checks if there is a TypeORM configuration file.