UNPKG

921 BMarkdownView Raw
1# @tractor/config-loader
2
3A configuration loader utility for [**tractor**](https://github.com/TradeMe/tractor).
4
5[![npm version](https://img.shields.io/npm/v/@tractor/config-loader.svg)](https://www.npmjs.com/package/@tractor/config-loader)
6
7## API
8
9### `loadConfig (cwd: string, configPath?: string): TractorConfig`
10
11Load a [**tractor** configuration file](https://github.com/TradeMe/tractor#config) from a given directory and path (defaults to *./tractor.conf.js*), before falling back to the default configuration.
12
13```typescript
14import { loadConfig } from '@tractor/config-loader';
15
16const config = loadConfig(process.cwd(), './path/to/tractor.conf.js');
17```
18
19### `getConfig (): TractorConfig`
20
21Retrieves the current config for the running Tractor instance. `loadConfig()` must be called befere calling `getConfig()`.
22
23```typescript
24import { getConfig } from '@tractor/config-loader';
25
26const config = getConfig();
27```