LoginSignup
29
14

More than 5 years have passed since last update.

Firebase FunctionsのConfigへJSON形式のファイルからsetする

Last updated at Posted at 2017-12-20

概要

Firebase Cloud FunctionsのConfigへJSON形式のファイルからsetする方法の共有です。

コマンド

terminal
firebase functions:config:set service_account="$(cat service-account.json)"

背景

Firebase Cloud Functionsで、Firebase Admin SDKに用意されているAPI(ユーザー管理 APIなど)を使用する際には、サービス アカウントが必要です。

しかし、サービスアカウントを作成・ダウンロードしたjsonファイルを元に変数を設定したかったのですが、「firebase functions:config:set」を使って、key=valueで1つずつ設定するのは果てしなく面倒くさい!と思って調べてみたところ、ちゃんとGitHubのissueに同じ悩みの人がいました。
https://github.com/firebase/firebase-tools/issues/406

参考

Firebase Cloud Functionsの環境変数設定に関する公式ドキュメント
https://firebase.google.com/docs/functions/config-env

29
14
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
29
14