Set environment variable for the process before startup
By "main", do you mean the Info.plist file of your .app ?
That's Apple recommandation so far: https://developer.apple.com/library/mac/#documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW1