Skip to content

Commit bc0e81a

Browse files
committed
Option to skip configuration file
1 parent 48de251 commit bc0e81a

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ EXPOSE 8082
1212

1313
COPY --from=fetch /target/application.jar /work/application.jar
1414

15-
CMD ["java", "-jar", "/work/application.jar"]
15+
ENTRYPOINT ["java", "-jar", "/work/application.jar"]

src/main/java/no/javazone/cake/redux/Configuration.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,19 @@ private static String readConf(String prop, String env, String defaultValue) {
4848

4949
private synchronized void loadProps() {
5050
Map<String,String> readProps = new HashMap<>();
51-
String config = readConfigFile(System.getProperty("cake-redux-config-file"));
52-
for (String line : config.split("\n")) {
53-
if (line.startsWith("#")) {
54-
continue;
51+
String filename = System.getProperty("cake-redux-config-file");
52+
if (!filename.equals("env-only")) {
53+
String config = readConfigFile(filename);
54+
for (String line : config.split("\n")) {
55+
if (line.startsWith("#")) {
56+
continue;
57+
}
58+
int eqpos = line.indexOf("=");
59+
if (eqpos == -1) {
60+
throw new IllegalArgumentException("Illegal line : " + line);
61+
}
62+
readProps.put(line.substring(0, eqpos), line.substring(eqpos + 1));
5563
}
56-
int eqpos = line.indexOf("=");
57-
if (eqpos == -1) {
58-
throw new IllegalArgumentException("Illegal line : " + line);
59-
}
60-
readProps.put(line.substring(0,eqpos),line.substring(eqpos+1));
6164
}
6265
properties = readProps;
6366
}

0 commit comments

Comments
 (0)