Run a command

$ garnet run <project-name>/<scope> -- <your executable>

run populates the environment with config from the specified project and environment scope, and executes the given command.

Config keys are case-sensitive (for example a config key defined as secret_key will not become SECRET_KEY)

For example, to run a npm server with env vars stored in Garnet in a project named frontend in the dev environment, all you have to do is:

$ garnet run frontend/dev -- npm start

Voila! This is it. You can use this convention for any script or executable, and Garnet will fetch up-to-date environment variables at build or run time.

Running multiple commands

You can also run multiple commands using the Garnet CLI. For example:

$ garnet run <project>/<scope> -- <command-1> && <command-2>

Using a Service Key

Service keys allow the Garnet CLI to fetch the scoped configuration without using the interactive method of garnet login. You can use the garnet run command with a service key by specifying the --service-key flag.

garnet run --service-key=<your-service-key> -- <command>

The service key can also be passed as an environment variable called GARNET_SERVICE_KEY to be read by the CLI. For example to use the service key inside a Dockerfile, you can do:

CMD garnet run --service-key=${GARNET_SERVICE_KEY} -- env