Direnv
For managing local environment variables, we're using direnv.
Run
direnv allow- This will load up the
.envrcfile. It should complain that you have missing variables. We'll fix that next.
- This will load up the
To fix the missing variables issue, you can do one of the following things:
Let
direnvget secret values withchamber. To enable this, run:cp .envrc.chamber.template .envrc.chambernotethat this method does not work for users of the
fishshell unless you replacedirenv allowwithdirenv export fish | sourcenoteif you have a very poor internet connection, this method may be problematic to you.
An alternative is to add a
.envrc.localfile. Then run:DISABLE_AWS_VAULT_WRAPPER=1 AWS_REGION=us-gov-west-1 aws-vault exec transcom-gov-dev -- chamber env app-devlocal >> .envrc.localIf you don't have access to
chamber, you can also runtouch .envrc.localthen add any values that the output from
direnvasks you to define.
Helpful variables for .envrc.local
Increase concurrency of
golangci-lint; defaults to 6 on dev machines and to 1 in CircleCI.export GOLANGCI_LINT_CONCURRENCY=8Enable go code debugging in goland
export GOLAND=1Silence SQL logs locally; we default this to be true in
.envrcexport DB_DEBUG=0
Troubleshooting direnv & chamber
Make sure you have the latest version of Chamber that supports the env command
option. You may run into the following error if the version of Chamber you have
installed does not support env. The error presents itself because of the
chamber commands that direnv runs as part of the .envrc.* files shown
above.
>_ cd mymove
direnv: loading .envrc.chamber
Error: unknown command "env" for "chamber"
Run 'chamber --help' for usage.