Skip to content

Commit 37f9f0e

Browse files
committed
Url.asMap(): modify logic a bit.
Prerequisite for #736 No functional changes.
1 parent dffe4a6 commit 37f9f0e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/main/java/ru/mystamps/web/Url.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
import java.util.HashMap;
2121
import java.util.Map;
2222

23+
import org.springframework.core.env.Environment;
24+
2325
/**
2426
* Holds path to site and all URLs.
2527
*
@@ -123,7 +125,9 @@ public final class Url {
123125
private Url() {
124126
}
125127

126-
public static Map<String, String> asMap(boolean serveContentFromSingleHost) {
128+
public static Map<String, String> asMap(boolean production) {
129+
boolean serveContentFromSingleHost = !production;
130+
127131
// Not all URLs are listed here but only those that are being used on views
128132
Map<String, String> map = new HashMap<>();
129133
map.put("PUBLIC_URL", PUBLIC_URL);

src/main/java/ru/mystamps/web/support/spring/boot/ThymeleafViewResolverInitializingBean.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ public void afterPropertiesSet() throws Exception {
6262
return;
6363
}
6464

65-
boolean useSingleHost = !environment.acceptsProfiles("prod");
66-
viewResolver.setStaticVariables(Url.asMap(useSingleHost));
65+
boolean productionEnv = environment.acceptsProfiles("prod");
66+
viewResolver.setStaticVariables(Url.asMap(productionEnv));
6767
}
6868

6969
}

0 commit comments

Comments
 (0)