https://github.com/onebeyond/confabulous-http-loader
A confabulous http loader
https://github.com/onebeyond/confabulous-http-loader
hacktoberfest
Last synced: about 2 months ago
JSON representation
A confabulous http loader
- Host: GitHub
- URL: https://github.com/onebeyond/confabulous-http-loader
- Owner: onebeyond
- License: mit
- Created: 2016-06-26T07:42:44.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-04-01T15:13:14.000Z (about 1 year ago)
- Last Synced: 2025-04-02T13:17:41.529Z (about 2 months ago)
- Topics: hacktoberfest
- Language: JavaScript
- Size: 335 KB
- Stars: 1
- Watchers: 15
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ⚠️ This repository is not longer maintained ⚠️
This project is not longer maintained and has been archived. More details in [One Beyond Governance Tiers](https://onebeyond-maintainers.netlify.app/governance/tiers)
# Confabulous HTTP Loader
Confabulous-HTTP-Loader is an HTTP Loader for [Confabulous](https://github.com/guidesmiths/confabulous) - a hierarchical, asynchronous config loader and post processor.## TL;DR
```
const confabulous = require('confabulous')
const Confabulous = confabulous.Confabulous
const http = require('confabulous-http-loader')
const processors = confabulous.processorsnew Confabulous()
.add((config) => http({ url: config.server.url, mandatory: false, watch: { interval: '5m' } }))
.on('loaded', (config) => console.log('Loaded', JSON.stringify(config, null, 2)))
.on('reloaded', (config) => console.log('Reloaded', JSON.stringify(config, null, 2)))
.on('error', (err) => console.error('Error', err))
.on('reload_error', (err) => console.error('Reload Error', err))
.end()
```### Options
| Option | Type | Default | Notes |
|----------|--------|-----------|---------|
| mandatory | boolean | true | Causes an error/reload_error to be emitted if the configuration does not exist |
| watch | object | | Watching is implemented by issuing HEAD requests and comparing the Etag and Last-Modified headers. You need to specify and interval in the configuration, e.g. ```{ watch: { interval: '5m' } }``` |
| request | object | [see here](https://github.com/guidesmiths/confabulous/blob/master/lib/loaders/http.js#L14) | options that will be passed to [the underlying http client](https://github.com/request/request).