B
B
BRONNER2015-01-29 16:32:58
Java
BRONNER, 2015-01-29 16:32:58

How to make a mutable constant dependent on the dev/prod environment in Java?

I have several variables in my application that need to be changed each time in order to debug locally and then upload the changes, let's say this:

public final class Properties {
    public static final String HOST= "localhost"; // dev = localhost | prod = mysite.com
}

I'm using Gradle to build and I can't figure out how to do this trick with java files

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2015-01-29
@zolt85

Add the values ​​to the properties file for each mode. When building the application, set the dev/prod parameter. Depending on the parameter, copy the required file to the assembly. You can get by with one file if you really want to. To do this, for each value, add the prefix dev or prod.
Or something like that)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question