Archived Support Site

This support site is archived. You can view the old support discussions but you cannot post new discussions.

How do I get server_path when storing Environmental variables at Appharbor ?

jalle007's Avatar

jalle007

26 Nov, 2016 09:28 PM

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 ?

  1. Support Staff 1 Posted by rune on 26 Nov, 2016 10:55 PM

    rune's Avatar

    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. 2 Posted by jalle007 on 26 Nov, 2016 11:10 PM

    jalle007's Avatar

    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!

  3. jalle007 closed this discussion on 26 Nov, 2016 11:10 PM.

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