You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was able to get the firebase emulator (realtime db and auth) up and running and discovered they can be made to cycle while persisting data. Was able to instrument the server/lib/duelyst_firebase_module.coffee file to use the emulators for auth and database read/write. Got as far as able to create a new user and it's details updated within the emulated db, but couldn't progress farther due to how old the firebase-web module is
Unsure if there is a way to instrument it to use a local emulator (seems not as it'll error if not provided a firebaseio.com url). I tried beautifying and disabling as much of the obfuscated code as I could to bypass the checks, but alas still nothing. I checked with firebase-web v8 and was able to connect to the emulator and read/write.
To get the final piece working and potentially have 100% offline duelyst development would either require
someone much more skillful at javascript to modify the firebase v2 module to prime and communicate with the emulator, I believe it'll accept any unsigned token
hope someone knows or has the documentation on how to hook up the emulator to firebase-web v2 (I've tried wayback machine to no success either, only goes back to 2016 for the emulator instrumentation logic)
implement issue #192 to update the frontend logic to firebase v8 or v9
Command I used to start up the emulator with persistency note: emulator has a logic that if project key starts with demo- prefix will ensure no calls accidentally reach to production instances, all calls will be only local firebase emulators:start --export-on-exit=./fire_emu_data --project demo-foobaryst --import=./fire_emu_data
Modifications done to instrument firebase-admin for emulator usage https://firebase.google.com/docs/emulator-suite/connect_auth#admin_sdks
for instrumenting the firebase-admin backend portion that Duelyst uses, all that is needed is to add the emulators url to a local environment variable and it'll do the rest. I hard coded it just for testing purposes, probably best practice would be to update the dotenv declaration.
line 1:
process.env.FIREBASE_AUTH_EMULATOR_HOST="192.168.33.3:9099"
any line with a firebaseServiceAccount reference
firebaseServiceAccount = {
project_id: "demo-foobaryst",
client_email: "[email protected]",
private_key: "cHJpdmF0ZWtleQo=",
}
line 82:
//with firebaseDBEmuUrl just the ip:port to the database, the first line/env set was ip:port for the auth
app = firebaseAdmin.initializeApp({databaseURL: firebaseDbEmuUrl}, firebaseDbEmuUrl)
Create user invocation success, but just hangs infinitely due to old firebase-web version
Snippet of Firebase Emulator UI showing Duelyst backend creating the user and initial boss rotation data
The text was updated successfully, but these errors were encountered:
I was able to get the firebase emulator (realtime db and auth) up and running and discovered they can be made to cycle while persisting data. Was able to instrument the server/lib/duelyst_firebase_module.coffee file to use the emulators for auth and database read/write. Got as far as able to create a new user and it's details updated within the emulated db, but couldn't progress farther due to how old the firebase-web module is
Unsure if there is a way to instrument it to use a local emulator (seems not as it'll error if not provided a firebaseio.com url). I tried beautifying and disabling as much of the obfuscated code as I could to bypass the checks, but alas still nothing. I checked with firebase-web v8 and was able to connect to the emulator and read/write.
To get the final piece working and potentially have 100% offline duelyst development would either require
Documentation on starting up the emulators and various flags
https://firebase.google.com/docs/emulator-suite/install_and_configure#startup
Command I used to start up the emulator with persistency
note: emulator has a logic that if project key starts with demo- prefix will ensure no calls accidentally reach to production instances, all calls will be only local
firebase emulators:start --export-on-exit=./fire_emu_data --project demo-foobaryst --import=./fire_emu_data
Modifications done to instrument firebase-admin for emulator usage
https://firebase.google.com/docs/emulator-suite/connect_auth#admin_sdks
for instrumenting the firebase-admin backend portion that Duelyst uses, all that is needed is to add the emulators url to a local environment variable and it'll do the rest. I hard coded it just for testing purposes, probably best practice would be to update the dotenv declaration.
Duelyst_firebase_module.coffee modifications for instrumentation
https://github.com/open-duelyst/duelyst/blob/main/server/lib/duelyst_firebase_module.coffee
note: I just added the env variable at the top of the file (before firebase module was loaded) and mocked in a dummy token for ease of testing
Create user invocation success, but just hangs infinitely due to old firebase-web version
Snippet of Firebase Emulator UI showing Duelyst backend creating the user and initial boss rotation data
The text was updated successfully, but these errors were encountered: