celest-dev / celest

The Flutter cloud platform
https://celest.dev
Other
233 stars 11 forks source link

Allow the code to specify/check if Celest is running locally or in the cloud (and where in the cloud). #43

Closed marcglasberg closed 7 months ago

marcglasberg commented 7 months ago

When you init the app:

celest.init(env: CelestEnvironment.local);
celest.init(env: CelestEnvironment.staging);
celest.init(env: CelestEnvironment.prod);

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:

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.

dnys1 commented 7 months ago

Love this! We're going to prioritize this for the 0.2.0 release.

dnys1 commented 7 months ago

This has been fixed in 0.2.0 🚀