1 | # @tractor/config-loader
|
2 |
|
3 | A 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 |
|
11 | Load 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
|
14 | import { loadConfig } from '@tractor/config-loader';
|
15 |
|
16 | const config = loadConfig(process.cwd(), './path/to/tractor.conf.js');
|
17 | ```
|
18 |
|
19 | ### `getConfig (): TractorConfig`
|
20 |
|
21 | Retrieves the current config for the running Tractor instance. `loadConfig()` must be called befere calling `getConfig()`.
|
22 |
|
23 | ```typescript
|
24 | import { getConfig } from '@tractor/config-loader';
|
25 |
|
26 | const config = getConfig();
|
27 | ```
|