0.0.6 • Published 9 years ago

rethinkdb-proxy v0.0.6

Weekly downloads
1
License
MIT
Repository
-
Last release
9 years ago

RethinkDB Proxy

Build Status npm version

Reverse proxy for RethinkDB

Make your RethinkDB publicly accessible through limiting what kind of queries can be executed on your RethinkDB database.

Introduction by Example

First, start the proxy.

$ rethinkdb-proxy --port 8125

Using the proxy, getting all users in the users table is allowed.

r.connect({ port: 8125 }).then((conn) => {
  r.table('users').coerceTo('array').run(conn)
    .then((results) => {
      // We have some results!
      console.log(results); // [{ name: 'jorge' }, ... ]
    });
});

But deleting the users is not:

import rethinkDBProxy from 'rethinkdb-proxy';
rethinkDBProxy({ port: 8125 });

r.connect({ port: 8125 }).then((conn) => {
  r.table('users').delete('array').run(conn)
    .catch((err) => {
      // We get an error!
      console.log(err); // RqlClientError: Cannot execute query. "DELETE" query not allowed
    });
});

Running rethinkdb-proxy

CLI

rethinkdb-proxy comes with a CLI out-of-the box:

rethinkdb-proxy --port 8125 

Module

You can also import rethinkdb-proxy into Node.js:

import rethinkDBProxy from 'rethinkdb-proxy';
rethinkDBProxy({ port: 8125, allowInsert: true });

Options

Port

Module ParameterCLI ParameterDefaultAPI Reference
port--port8125

Port in which to listen for driver connections. You should point your driver to this port.

RethinkDB Host

Module ParameterCLI ParameterDefaultAPI Reference
rdbHost--rdb-hostlocalhostconnect

Host in which RethinkDB is running.

RethinkDB Port

Module ParameterCLI ParameterDefaultAPI Reference
rdbPort--rdb-hostlocalhostconnect

Host in which RethinkDB is running.

Databases

Module ParameterCLI ParameterDefaultAPI Reference
dbs--dbs[ ]

Database to allow access to. By default, all database are allowed except rethinkdb.

Allow System Database Access

Module ParameterCLI ParameterDefaultAPI Reference
allowSysDbAccess--allow-sys-db-accessfalse

Allow access to the rethinkdb database. This is not allowed by default, because access to this database allows to delete all other data.

Tables

Module ParameterCLI ParameterDefaultAPI Reference
tables--tables[ ]

Tables to allow access to. Tables must include their database db.table.

Allow Writes

Module ParameterCLI ParameterDefaultAPI Reference
allowWrites--allow-writesfalse

Allow all operations that write to the database (insert, update, delete).

Allow insert

Module ParameterCLI ParameterDefaultAPI Reference
allowInsert--allow-insertfalseinsert

Allow insert queries.

Allow update

Module ParameterCLI ParameterDefaultAPI Reference
allowUpdate--allow-updatefalseupdate

Allow update queries.

Allow delete

Module ParameterCLI ParameterDefaultAPI Reference
allowDelete--allow-deletefalsedelete

Allow delete queries.

Allow replace

Module ParameterCLI ParameterDefaultAPI Reference
allowReplace--allow-replacefalsereplace

Allow replace queries.

Allow dbCreate

Module ParameterCLI ParameterDefaultAPI Reference
allowDbCreate--allow-db-createfalsedbCreate

Allow dbCreate queries

Allow dbDrop

Module ParameterCLI ParameterDefaultAPI Reference
allowDbDrop--allow-db-dropfalsedbDrop

Allow dbDrop queries

Allow tableCreate

Module ParameterCLI ParameterDefaultAPI Reference
allowTableCreate--allow-table-createfalsetableCreate

Allow tableCreate queries.

Allow tableDrop

Module ParameterCLI ParameterDefaultAPI Reference
allowTableDrop--allow-table-dropfalsetableDrop

Allow tableDrop queries.

Allow Indexes

Module ParameterCLI ParameterDefaultAPI Reference
allowIndexes--allow-indexesfalse

Allow all operations on indexes (indexCreate, indexDrop, indexRename).

Allow indexCreate

Module ParameterCLI ParameterDefaultAPI Reference
allowIndexCreate--allow-index-createfalseindexCreate

Allow indexCreate queries.

Allow indexDrop

Module ParameterCLI ParameterDefaultAPI Reference
allowIndexDrop--allow-index-dropfalseindexDrop

Allow indexDrop queries.

Allow indexRename

Module ParameterCLI ParameterDefaultAPI Reference
allowIndexRename--allow-index-renamefalseindexRename

Allow indexRename queries.

Allow reconfigure

Module ParameterCLI ParameterDefaultAPI Reference
allowReconfigure--allow-reconfigurefalsereconfigure

Allow reconfigure queries.

Allow rebalance

Module ParameterCLI ParameterDefaultAPI Reference
allowRebalance--allow-rebalancefalserebalance

Allow rebalance queries.

Allow http

Module ParameterCLI ParameterDefaultAPI Reference
allowHttp--allow-httpfalsehttp

Allow queries with the http term.

Allow js

Module ParameterCLI ParameterDefaultAPI Reference
allowJavascript--allow-javascriptfalsejs

Allow queries with the js term.

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago