Is there a way for an application to tell if it's deployed to a DABL ledger?
- anthonyOP
If I deployed an application on DABL I could:
- Have the frontend UI hosted directly on DABL and discover where it’s hosted via
window.location
But can I do the following dynamically?
- Host the frontend outside of DABL and have the frontend determine if it’s still hosted on DABL?
- Have the DAML application/a contract determine if it’s deployed on DABL?
- Have the frontend UI hosted directly on DABL and discover where it’s hosted via
- dtanabe
At the moment, no there isn’t a special or sanctioned way to determine if you are running on DABL.
window.locationis by far the most straightforward way to find out; you could use various APIs as documented ondocs.projectdabl.com/apibut I wouldn’t necessarily recommend that sincewindow.locationis 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?
- anthony
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.
- dtanabe
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.
- anthony
In this case it would be because any deployment to DABL shouldn’t store private health information
- dtanabe
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.
- anthony
Fair, maybe I shouldn’t do this in the app then.