CLI

Get a technical overview of the commands you can perform with Grey Matter.

The following commands let you manipulate objects in the Grey Matter mesh.

Command

Description

greymatter

Base command for performing operations on the Grey Matter Service Mesh.

configs

Display the current CLI configurations.

create

Create a specific object in the Grey Matter mesh.

delete

Delete a specific object and its configurations from the Grey Matter mesh.

edit

Edit the configuration of an existing object in the Grey Matter mesh.

generate

Generate textual output from a template.

get

Get a specific object and its configurations from the Grey Matter mesh.

help

Display help text for commands

list

List objects and their configurations in the Grey Matter mesh.

import-zone/export-zone

import/export zones and all their associated objects.

sync

Synchronizes the source and destination.

utils

Utils contain utility sub-commands.

version

Display the version and build information of the CLI

Configuring CLI

The Grey Matter CLI global options are configured either through command-line flags, a configuration file, or their environment variable equivalents, listed below.

The order of precedence for all settings is flags > environment variables > a configuration file. For more information about configuration files, see Configuration File section below.

General Settings

Flag

Environment Variable

Description

Required

Default

Example

-c, --config

(not configurable via env var)

Location of the CLI config file

No

"$HOME/.greymatter.yaml"

~/prod.json

-l, --console.level

GREYMATTER_CONSOLE_LEVEL

Log level setting of the greymatter CLI. Valid values are "debug", "info", "error", or "none"

No

error

info

-f, --format

GREYMATTER_FORMAT

Whether to use JSON or YAML to format objects sent or received from the Control API. Valid values are "json" or "yaml"

No

""

yaml

Control API Settings

Flag

Environment Variable

Description

Required

Default

Example

--api.host

GREYMATTER_API_HOST

The host and port of the Grey Matter installation, without protocol prefix

Yes

""

greymatter.development.deciphernow.com:443

--api.prefix

GREYMATTER_API_PREFIX

The route to the Control API within a Grey Matter installation without trailing slash

Yes

""

/services/gm-control-api/1.0

--api.version

GREYMATTER_API_VERSION

The schema version of the Control API

No

"v1.0"

v1.0

--api.ssl

GREYMATTER_API_SSL

Whether to use SSL (https) when communicating with the Control API service

No

""

true

--api.sslcert

GREYMATTER_API_SSLCERT

Path to a PEM-encoded user PKI certificate file authorized to configure the mesh

No

""

/path/to/cert.pem

--api.sslkey

GREYMATTER_API_SSLKEY

Path to a PEM-encoded user PKI key file authorized to configure the mesh (un-encrypted)

No

""

/path/to/key.pem

--api.insecure

GREYMATTER_API_INSECURE

Whether to attempt verification of the host's certificate

No

false

true

--api.header

GREYMATTER_API_HEADER

Specifies a custom header to send with every API request. Headers are given as name:value pairs, and can be separated with commas for multiple headers.

No

""

"Authorization: Bearer y29..."

Catalog API Settings

Flag

Environment Variable

Description

Required

Default

Example

--catalog.mesh

GREYMATTER_CATALOG_MESH

The name of the mesh to reference when interacting with Grey Matter Catalog

Yes

""

zone-default-zone

--catalog.host

GREYMATTER_CATALOG_HOST

The host and port of the Grey Matter Catalog installation (if different from api.host), without protocol prefix

No

Value of api.host

greymatter.development.deciphernow.com:443

--catalog.prefix

GREYMATTER_CATALOG_PREFIX

The route to the Catalog API within a Grey Matter installation without trailing slash

Yes

""

/services/gm-catalog/1.0

--catalog.ssl

GREYMATTER_CATALOG_SSL

Whether to use SSL (https) when communicating with the Catalog API

No

Value of api.ssl

true

--catalog.sslcert

GREYMATTER_CATALOG_SSLCERT

Path to a PEM-encoded user PKI certificate file authorized to configure the mesh

No

Value of api.sslcert

/path/to/cert.pem

--catalog.sslkey

GREYMATTER_CATALOG_SSLKEY

Path to a PEM-encoded user PKI key file authorized to configure the mesh (un-encrypted)

No

Value of api.sslkey

/path/to/key.pem

--catalog.insecure

GREYMATTER_CATALOG_INSECURE

Whether to attempt verification of the host's certificate

No

Value of api.insecure

true

Configuration File

Unless specified via --config flag, Grey Matter CLI will search a user's home directory for a file with a name prefixed with .greymatter. The accepted format of the file are JSON and YAML.

If multiple files are found, the CLI will nondeterministically choose one of them. Therefore it's best to have only one file.

As mentioned above, the order of precedence for all settings is flags > environment variables > a configuration file. So if there are flags or environment variables set, what is in the configuration file will not affect the behavior of the CLI. For checking the actual configuration read by the CLI, please type greymatter configs to check. If you are using a custom configuration file, please run the command like so greymatter configs --config [your-config-file-name].

The following configuration is a minimal example that is typical for normal use of the CLI:

greymatter.yaml or .greymatter.yml

console:
level: error
format: yaml
api:
host: localhost:30000
prefix: /services/control-api/latest
ssl: true
insecure: true
sslcert: /Users/my-name/git/helm-charts/certs/quickstart.crt
sslkey: /Users/my-name/git/helm-charts/certs/quickstart.key
catalog:
prefix: "/services/catalog/latest"
mesh: zone-default-zone

greymatter.json

{
"console": {
"level": "error"
},
"format": "yaml",
"api": {
"host": "localhost:30000",
"prefix": "/services/control-api/latest",
"ssl": true,
"insecure": true,
"sslcert": "/Users/someone/git/helm-charts/certs/quickstart.crt",
"sslkey": "/Users/someone/git/helm-charts/certs/quickstart.key"
},
"catalog": {
"prefix": "/services/catalog/latest",
"mesh": "zone-default-zone"
}
}

When configuring the CLI's connection to the Catalog API, you may omit most of its connection settings if they coincide with the corresponding Control API settings.

For configuring sync functionality, it is recommended to do so via a config file. For more details. please refer to the sync section.

Questions

Need help with the CLI? Contact our team at Grey Matter Support.