# hathor-file-config

> A JS configuration file loader for Hathor.

Latest version **0.0.6** (published 2017-04-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install hathor-file-config
pnpm add hathor-file-config
yarn add hathor-file-config
bun add hathor-file-config
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2017-04-17 |
| First published | 2017-01-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jeremy Darling |
| Maintainers | jdarling |

## Links

- npm: https://www.npmjs.com/package/hathor-file-config
- npm.io page: https://npm.io/package/hathor-file-config

## Dependencies (3)

- [hathor-utils](https://npm.io/package/hathor-utils.md) 0.0.2
- [hathor-config](https://npm.io/package/hathor-config.md) 0.0.2
- [hathor-logger](https://npm.io/package/hathor-logger.md) 0.0.1

## Recent versions

- 0.0.6 (latest) — 2017-04-17
- 0.0.5 — 2017-02-02
- 0.0.4 — 2017-01-27
- 0.0.3 — 2017-01-27
- 0.0.1 — 2017-01-26

## README

Hathor File Configuration Provider
===

Used to provide configuration values to a Hathor application, plugins, and routes from a JavaScript or JSON source file.

Install
---

```
npm install --save hathor-file-config
```

Usage
---

```js
const {Server} = require('hathor');
const Config = require('hathor-config');
const FileConfig = require('hathor-file-config');
const logger = require('hathor-logger');

const config = new Config();
config.merge(new FileConfig('config/config'));
config.set('server.logger', logger);

const serverConfig = config.get('server', {});
const server = new Server(serverConfig);

server.start((err)=>{
  logger.error(err);
  process.exit(1);
});
```

API
---

Extends [Hathor Configuration Provider](https://github.com/anarchistengineering/hathor-config)

### Config.create(configurationFileName, options)

Attempts to to load the configuration values from configurationFileName.  The first attempt is performed as loading using require(), if that fails then the configuration file is processed as a JSON raw string.  If both fail an error is thrown.

Introduces options.base as the base configuration object to utilize.

---
_Source: https://npm.io/package/hathor-file-config · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
