0
0

Node.jsのdb-migrateで環境変数を利用する

Last updated at Posted at 2024-04-02

目的

Node.jsでdb-migrageパッケージを用いてMigrationをしたい。
その際、jsonファイル内で環境変数を用いてMySQLのパスワードを設定したい。

参考

解決策

公式のDocumentにしっかりと書かれていた。

You can also specify environment variables in your config file by using a >special notation. Here is an example:

database.json
{
 "prod": {
   "driver": "mysql",
   "user": {"ENV": "PRODUCTION_USERNAME"},
   "password": {"ENV": "PRODUCTION_PASSWORD"}
 },
}
"password": {"ENV": "環境変数"}

の形で利用する事ができるらしい。

0
0
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
0