Installation and configuration

Prerequisite: Node.js, version 14.x or newer.

Installation

To install fauna-shell globally and create a default, YAML-formatted configuration file, enter:

npm install -g fauna-shell

Configuration

For Linux, macOS, and other UNIX-like systems, the configuration file is located in the $HOME/.fauna-shell directory.

For Windows systems, the configuration file is located in the %userprofile%\.fauna-shell directory.

You can configure fauna-shell for one or more connection endpoints. An endpoint defines the domain, secret, and other properties needed to query a Fauna instance.

In the following example, the default endpoint is defined in the first line as db2 and there is a corresponding db2 endpoint configuration.

default=db2

[localhost]
domain=127.0.0.1
port=8443
scheme=http
secret=secret

[cloud]
domain=db.fauna.com
scheme=https
secret=fnADS@PxN@2CE@n7z@kDa4_p6Z@fIBaZm@Qt@bYT

[db2]
domain=private.example
port=8443
scheme=https
secret=MY_ORGANIZATION_SECRET

An endpoint entry begins with a [<endpoint>] header, which is the name or alias for the endpoint, and is followed by the endpoint configuration properties.

If a property is duplicated, fauna-shell uses the last definition.

Global properties

Configuration key Description

default=<alias>

(Optional) Default endpoint alias. If fauna-shell is started without the --endpoint option, the shell uses this endpoint, and there must be a corresponding endpoint configuration in the file. If a default endpoint is not defined and the --endpoint option is not used, an error is generated.

Endpoint properties

Property Required Description

domain=<Fauna hostname>

No

Hostname of this endpoint Fauna instance.
Default = db.fauna.com

scheme=<scheme>

No

Connection scheme. One of:

  • https (Default)

  • http

port=<port>

No

UNIX port number of this endpoint Fauna instance.
Defaults = 443.

secret=<secret>

Yes

Database secret.

queriesFile=<name>

Yes

File name that has queries to run using the eval command.

query=<query>

Yes

Query to use with the eval command.

You can add more properties to differentiate between endpoints, but they are ignored.

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!