Is there a way for an application to tell if it's deployed to a DABL ledger?

If I deployed an application on DABL I could:

  1. Have the frontend UI hosted directly on DABL and discover where it’s hosted via window.location

But can I do the following dynamically?

  1. Host the frontend outside of DABL and have the frontend determine if it’s still hosted on DABL?
  2. Have the DAML application/a contract determine if it’s deployed on DABL?

At the moment, no there isn’t a special or sanctioned way to determine if you are running on DABL.

window.location is by far the most straightforward way to find out; you could use various APIs as documented on but I wouldn’t necessarily recommend that since window.location is such an easy and simple solution.

Just out of curiosity, what are you looking to do based on whether you are running in DABL or not?

Working on the healthcare claims refapp and want to display a warning that it’s only suitable for dev/demo use when deployed on DABL.

Wouldn’t that be the case no matter where it is deployed if it’s a reference application? I think of “reference app” as “sample app”; anyone looking to use it for a real use case would certainly at least want to customize the appearance and make a few minor changes.

In this case it would be because any deployment to DABL shouldn’t store private health information

Couldn’t that limitation apply to other ledgers as well? I suppose I’m saying the warning should either be there as part of your app, or not—or potentially be a configuration option in the hands of the person deploying the software. Certainly it seems like this would be a legitimate warning to show during dev time on someone’s development laptop, which would also be a non-ideal platform for storing private health information.

Fair, maybe I shouldn’t do this in the app then.