在.envrc文件中设置环境变量
安装direnv
$ brew install direnv
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
gptfdisk pijul
==> Updated Formulae
abcde grpc puzzles
angle-grinder gtk-vnc quicktype
angular-cli gutenberg rabbitmq
awscli harfbuzz redis
cargo-completion hashcat ripgrep
cassandra kerl rust
chronograf knot-resolver sceptre
composer kotlin shfmt
cryptol libpst shibboleth-sp
csvprintf libxkbcommon skaffold
cython liquigraph snakemake
dartsim logtalk taskell
dbus macvim teleport
dcos-cli mariadb@10.0 tmux-xpanes
django-completion mercurial todolist
dxpy mkdocs tox
emscripten node trafficserver
erlang@20 node-build uhd
faas-cli ocrmypdf vcftools
firebase-cli openshift-cli webpack
flow paket wireguard-tools
fluent-bit passenger wxmac
gammaray percona-server-mongodb xml-security-c
git-lfs phpunit xtensor
go-jira pilosa yarn
go-statik presto youtube-dl
goenv proselint zebra
Error: Could not link:
/usr/local/share/man/man1/brew.1
Please delete these paths and run `brew update`.
Error: Could not link:
/usr/local/share/doc/homebrew
Please delete these paths and run `brew update`.
==> Downloading https://homebrew.bintray.com/bottles/direnv-2.17.0.sierra.bottle
######################################################################## 100.0%
==> Pouring direnv-2.17.0.sierra.bottle.tar.gz
? /usr/local/Cellar/direnv/2.17.0: 9 files, 5.4MB
用编辑器打开 .bashrc 文件。
open ~/.bashrc
在接下来中加入以下内容。
eval "$(direnv hook bash)"
在.envrc文件中设置环境变量
export APIKEY=<APIKEY>
export AUTHDOMAIN=<AUTHDOMAIN>
export DATABASEURL=<DATABASEURL>
export PROJECTID=<PROJECTID>
export STORAGEBUCKET=<STORAGEBUCKET>
export MESSAGINGSENDERID=<MESSAGINGSENDERID>
direnv: loading .envrc
direnv: export +APIKEY +AUTHDOMAIN +DATABASEURL +MESSAGINGSENDERID +PROJECTID +STORAGEBUCKET
direnv: unloading
direnv: error .envrc is blocked. Run `direnv allow` to approve its content.
$ direnv allow