Socket
Book a DemoInstallSign in
Socket

confabulous-postgres-loader

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

confabulous-postgres-loader

A confabulous postgres loader

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

Build Status

Confabulous Postgres Loader

Confabulous-Postgres-Loader is an PostgreSQL Loader for Confabulous - a hierarchical, asynchronous config loader and post processor.

TL;DR

const confabulous = require('confabulous')
const postgres = require('confabulous-postgres-loader')
const Confabulous = confabulous.Confabulous
const processors = confabulous.processors

new Confabulous()
    .add((config) => postgres({
        url: 'postgres://user:secret@localhost:5432/config',
        query: 'SELECT data FROM config WHERE key=$1',
        params: ['my-app']
    }, [
      (rows, cb) => cb(null, rows[0] && rows[0].data)
    ]))
    .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

OptionTypeDefaultNotes
urlstringPostgres connection url
querystringQuery for selecting config
paramsarray[]Parameters to be passed to query
mandatorybooleantrueCauses an error/reload_error to be emitted if the configuration does not exist
watchobjectConfigures the watcher { query: 'SELECT last_modified FROM config WHERE key=$1', params: ['my-app']}, interval: '5m' }

Keywords

Confabulous

FAQs

Package last updated on 25 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts