How to check the environment if it's Production or Local on App Engine Flex Java?

62 views
Skip to first unread message

Fouad Almalki

unread,
Dec 14, 2016, 11:29:07 AM12/14/16
to Google App Engine
For example, Is there any system/environment variable that is set automatically when deploying java flex app on Google Cloud?

Fouad Almalki

unread,
Dec 18, 2016, 6:07:44 AM12/18/16
to Google App Engine
As a workaround, I added the following to jetty.xml:

<Call class="java.lang.System" name="setProperty">
<Arg>env.local</Arg>
<Arg>true</Arg>
</Call>


Then from the code:


public static boolean isLocalEnvironment()
{
String result = System.getProperty("env.local");
   return "true".equals(result);
}

Thanasis Delenikas

unread,
Dec 18, 2016, 6:20:02 AM12/18/16
to Google App Engine
Check "environment.value()" - possible values: Value.Development or Value.Development.

Thanasis Delenikas

unread,
Dec 18, 2016, 6:20:53 AM12/18/16
to Google App Engine
Sorry for the typo... Possible values: Value.Development or Value.Production.
Reply all
Reply to author
Forward
0 new messages