Where CelestEnvironment is autogenerated with the client as an enum.
Then, I can access it from BOTH the frontend and the backend code, like this: celest.env
This has a few uses:
I can show this info in the app UI, just like the "debug banner" Flutter shows.
I can simulate third-party services, when I'm running local.
I can use staging versions of third-party services, when I'm running staging.
I can run the real third-party services, when I'm running prod.
enum CelestEnvironment {
local, staging, prod;
bool get isLocal => this == CelestEnvironment.local;
bool get isCloud => this == CelestEnvironment.staging || this == CelestEnvironment.prod;
}
👉 Extra points if I can later run celest.init() again to plug another environment while the app is running.
When you
init
the app:Where
CelestEnvironment
is autogenerated with the client as anenum
.Then, I can access it from BOTH the frontend and the backend code, like this:
celest.env
This has a few uses:
local
.staging
.prod
.👉 Extra points if I can later run
celest.init()
again to plug another environment while the app is running.