I am running a console application on OSX that has the following...
public static void main(string[] args)
{
string mongoEndpoint = Environment.GetEnvironmentVariable("MONGO_ENDPOINT");
if(string.IsNullOrEmpty(mongoEndpoint))
{
_log.Fatal("Invalid Mongo Endpoint");
throw new Exception("Invalid Mongo Endpoint");
}
}
I have added a MONGO_ENDPOINT
environment variable to my ~/.bash_profile
and when I run echo $MONGO_ENDPOINT
it outputs the correct value.
However, when I run my console application from Xamarin Studio in OSX, it returns null.
I tried running the following to see if it was all environment variables, and it returned the correct value.
Console.Out.WriteLine(Environment.GetEnvironmentVariable("HOME"));
and it outputted /usr/myname
perfectly fine.
Any reason why it would not be able to find this environment variable?