0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

envファイル管理はこれ一択!

Last updated at Posted at 2020-03-30

環境変数管理

背景

秘密鍵を使うこともあり,
sample用の.env.sampleと開発用の.envファイルを分けている

.env.sample をコミットに残すため、こちらを正として.envを管理したい

インストール方法

go get github.com/locona/envdef/cmd/envdef

使い方

テストデータ準備

プロジェクトのルートにある.envファイルにアプリケーション構成を追加します。

S3_BUCKET=YOURS3BUCKET
SECRET_KEY=YOURSECRETKEYGOESHERE

プロジェクトのルートにある.env.sampleファイル

S3_BUCKET=YOURS3BUCKET
SECRET_KEY=YOURSECRETKEYGOESHERE
REGION=REGION

実行

次に実行します

envdef

その結果、.env.newファイルが作成されます

REGION=REGION
S3_BUCKET=YOURS3BUCKET
SECRET_KEY=YOURSECRETKEYGOESHERE

console にも変更点が表示されます

まとめ

envdef を使うことにより、不要になった環境変数や追加された環境変数の管理が楽になりました

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?