Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the general practice to set a flag that has a different value in production than it does in dev

Tags:

java

flags

Supposed I have a flag public static final boolean FLAG. In development, I want it to be true, but in production, I want it to be false.

Should I just literally set it to true while developing, and when we build/release, someone would go in and change it to false?

I have a feeling that's so not the way to go, as it looks horrible.

What is the approach I should take?

like image 209
One Two Three Avatar asked Mar 21 '14 02:03

One Two Three


1 Answers

Sounds like a good place for a system property, if not a properties file. -Dflag=true

Where -D is part of the line used to start the JVM. On Tomcat its in the JAVA_OPTS environment variable in setenv.sh under bin/

like image 155
user447607 Avatar answered Nov 01 '22 19:11

user447607