スキップしてメイン コンテンツに移動

投稿

ラベル(environment)が付いた投稿を表示しています

Firebaseでエミュレータを設定(確認)する方法

サーバサイドのfirebase-adminの場合 Node.jsを利用したサーバー側では、 process.env を参照するとFirebase functionsの実行環境の情報を取得できます。 firebase-admin を利用したエミュレータ環境の設定も process.env から確認できます。index.jsに下記のログ出力を加えてみます。 console.log(JSON.stringify(process.env, null, 3)); firebase emulators:start を実行してエミュレータ環境でfirebaseを起動させると、エミュレータの設定状況に応じて、下記のようなエントリがログ出力されます。 "FIREBASE_AUTH_EMULATOR_HOST" : "localhost:9099" "FIREBASE_DATABASE_EMULATOR_HOST" : "localhost:9000" , "FIREBASE_STORAGE_EMULATOR_HOST" : "localhost:9199" , "FIRESTORE_EMULATOR_HOST" : "localhost:8080" , "FUNCTIONS_EMULATOR" : "true" index.js内で firebase-admin から作成されたサービスはすべてエミュレータに接続されます。 const admin = require ( 'firebase-admin' ) ; admin . initializeApp ( { credential : admin . credential . cert ( "XXXXXXXX.json" ) , storageBucket : "YYYYYYY.appspot.com" , } ) ; admin . firestore ( ) ; admin . storage (

Symfony2: Switching URL for Different Environment

Issue For Symfony2, if you would like to setup different url based on environment but using same action in controller, what should we do? In my case, I would have liked to setup different url based on different country enviroment but would have liked to use same action becaseu the functionality itself is completely same. Solution Setup routing.yml for each environment. Symfony2 porvides mailnly 2 ways to setup routing configuration - routing.yml and annotation on controller. I think using annotation is better way because you can easily check functionality and routing relation in controller class. However if you would like to setup different url based on different environment, using routing.yml is better way. Ok now I will show you my approach.... 1) You should prepare routing_shared.yml for common shared routing between environment. 2) You should preare routing.yml for rach enviroment which is depends on the environment, like routing_env_1.yml, routing_env_2.yml, etc. And