How do I get server_path when storing Environmental variables at Appharbor ?
I am using Google.Apis.Vision in my aplication.
Google requires one environmental variable to be set that points to a JSON file , like this :
GOOGLE_APPLICATION_CREDENTIALS = server_path\VisionAPI-0a3feb1f1da5.json
So this is env var does not contain value but it contains absolute url to the file.
How do I get server_path when storing Env variables at Appharbor ?
Discussions are closed to public comments.
If you need help with AppHarbor please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by rune on 26 Nov, 2016 10:55 PM
Hi,
You can get paths relative to your web application's root path using for instance
Server.MapPath
, so if the json file you mention is located in the root directory this should work:Server.MapPath(~/VisionAPI-0a3feb1f1da5.json)
.Also, make sure the file is actually copied to the website output directory (if you haven't already). Setting the "Build Action" property to
Content
in VS should make sure it's copied when AppHarbor processes the build.Best,
Rune
2 Posted by jalle007 on 26 Nov, 2016 11:10 PM
YEah that is exactly what I already did , and it worked :)
And after getting absolute path I created Env var on the fly.
It works perfectly!
jalle007 closed this discussion on 26 Nov, 2016 11:10 PM.