Skip to content

Configuration

Doug Hatcher edited this page May 20, 2021 · 8 revisions

Mach supports both environment variables and yaml files, by default it expects a .mach.yaml file in your working directory.

When building projects around mach, always create and commit a base .mach.yaml. Take care not to track variables like docker credentials.

Dealing with Secrets

direnv can be used to manage configurations that should not be tracked in the repo, such as credentials like MACH_DOCKER_USER and MACH_DOCKER_PASS. Any configuration from a .mach.yaml file can also be expressed as an environment variable, in all caps, with a MACH_ prefix. i.e. docker_user in yaml would be expressed as $MACH_DOCKER_USER and can be provided through a pipeline, or something like direnv.

Be sure to install direnv first and configure it.

~/path/to/mach/project/.envrc

export MACH_DOCKER_USER=<docker_username>
export MACH_DOCKER_PASS=<docker_password>

Remember to ignore and not track .envrc!

AWS Credentials

AWS authentication is performed through the golang library, which provides a variety of ways to authenticate. You can use a tool like aws-vault, ~/.aws/credentials files or environment variables such as:

$ export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
$ export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
$ export AWS_DEFAULT_REGION=us-west-2
Clone this wiki locally