Help, in vibe.d, how to get configure var of mongodb in heroku?

MichaelBi shunjie.bi at gmail.com
Fri May 13 05:18:26 UTC 2022


there are online documents of heroku on how to access config var 
value from code, and several code samples without D. link here: 
https://devcenter.heroku.com/articles/config-vars#accessing-config-var-values-from-code.

     i have code here:
         auto uri = environment.get("MONGODB_URI");
         MongoClient conn = connectMongoDB(uri);
         MongoDatabase eqpdb = conn.getDatabase("MbEqpHeroku");

the "MONGODB_URI" showed above already put into heroku's app 
config as the 'key' and there is a paired 'value'. so the uri is 
to extract the value which is to use for app to establish  
mongodb connection.

and above code with error msg here: Error: `getenv` cannot be 
interpreted at compile time, because it has no available source 
code

so don't know how to make change. thanks in advance!


More information about the Digitalmars-d-learn mailing list