Skip to main content

DGate CLI

dgate-cli is a command line interface for the DGate Admin API. This document provides an overview of its usage, commands, and options.

Installation

To install DGate CLI, you can use the following command:

go install github.com/dgate-io/dgate/cmd/dgate-cli@latest
dgate-cli --help

Using Docker

docker pull ghcr.io/dgate-io/dgate:latest
docker run -it --rm ghcr.io/dgate-io/dgate dgate-cli --help

Loading...

Usage

dgate-cli [global options] command [command options]

Global Options

OptionDescriptionDefaultEnvironment Variable
--admin valueThe URL for the file clienthttp://localhost:9080DGATE_ADMIN_API
--auth value, -a valueBasic auth username:password; or just username for password promptDGATE_ADMIN_AUTH
--follow, -fFollows redirects, useful for raft leader changesfalseDGATE_FOLLOW_REDIRECTS
--verbose, -VEnable verbose loggingfalse
--help, -hShow help
--version, -vPrint the version

Commands

CommandAliasDescription
namespacensNamespace management commands
servicesvcService management commands
modulemodModule management commands
routertRoute management commands
domaindomDomain management commands
collectioncolCollection management commands
documentdocDocument management commands
secretsecSecret management commands
helphShows a list of commands or help for one command

Resource Commands

The following subcommands are available for all resources (namespace, domain, service, module, route, collection, document, secret).

Usage

dgate-cli <resource> command [command options] <command> <name>

Subcommands

SubcommandAliasDescription
createmkCreate a resource
deletermDelete a resource
listlsList resources
getGet a resource
helphShows help for commands

Options

OptionDescription
--help, -hShow help

Examples

Creating a Resource

dgate-cli namespace create name=my-namespace
dgate-cli domain create name=my-domain
dgate-cli service create name=my-service
dgate-cli module create name=my-module
dgate-cli route create name=my-route
dgate-cli collection create name=my-collection
dgate-cli document create name=my-document
dgate-cli secret create name=my-secret

Deleting a Resource

dgate-cli namespace delete my-namespace
dgate-cli domain delete my-domain
dgate-cli service delete my-service
dgate-cli module delete my-module
dgate-cli route delete my-route
dgate-cli collection delete my-collection
dgate-cli document delete my-document
dgate-cli secret delete my-secret

Listing Resources

dgate-cli namespace list
dgate-cli domain list
dgate-cli service list
dgate-cli module list
dgate-cli route list
dgate-cli collection list
dgate-cli document list
dgate-cli secret list

Fetching a Resource

dgate-cli namespace get name=my-namespace
dgate-cli domain get name=my-domain
dgate-cli service get name=my-service
dgate-cli module get name=my-module
dgate-cli route get name=my-route
dgate-cli collection get name=my-collection
dgate-cli document get name=my-document
dgate-cli secret get name=my-secret

For more information on a specific command, use the help subcommand with the desired command.

dgate-cli namespace help create
dgate-cli domain help create
dgate-cli service help create
dgate-cli module help create
dgate-cli route help create
dgate-cli collection help create
dgate-cli document help create
dgate-cli secret help create