Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1799fe9

Browse files
committed
Config cleanup
1 parentbce7e7c commit1799fe9

File tree

6 files changed

+45
-59
lines changed

6 files changed

+45
-59
lines changed

‎stubbornjava-common/src/main/java/com/stubbornjava/common/Configs.java‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ public Builder() {
9090
}
9191

9292
publicBuilderwithResource(Stringresource) {
93-
conf =conf.withFallback(ConfigFactory.parseResources(resource));
94-
log.info("Loaded config file from resource ({})",resource);
93+
ConfigresourceConfig =ConfigFactory.parseResources(resource);
94+
Stringempty =resourceConfig.entrySet().size() ==0 ?" contains no values" :"";
95+
conf =conf.withFallback(resourceConfig);
96+
log.info("Loaded config file from resource ({}){}",resource,empty);
9597
returnthis;
9698
}
9799

@@ -132,7 +134,7 @@ public Config build() {
132134
conf =conf.resolve();
133135
if (log.isDebugEnabled()) {
134136
log.debug("Logging properties. Make sure sensitive data such as passwords or secrets are not logged!");
135-
log.debug(conf.root().render(ConfigRenderOptions.concise().setFormatted(true)));
137+
log.debug(conf.root().render());
136138
}
137139
returnconf;
138140
}

‎stubbornjava-common/src/test/resources/application.conf‎

Lines changed: 0 additions & 28 deletions
This file was deleted.

‎stubbornjava-common/src/test/resources/application.local.conf‎

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
packagecom.stubbornjava.webapp;
2+
3+
importorg.slf4j.Logger;
4+
importorg.slf4j.LoggerFactory;
5+
6+
importcom.stubbornjava.common.Configs;
7+
importcom.stubbornjava.common.Env;
8+
importcom.stubbornjava.common.Json;
9+
importcom.typesafe.config.Config;
10+
11+
publicclassWebappBoostrap {
12+
privatestaticfinalLoggerlogger =LoggerFactory.getLogger(WebappBoostrap.class);
13+
14+
publicstaticConfiggetConfig() {
15+
Configconfig =Configs.newBuilder()
16+
.withOptionalRelativeFile("./secure.conf")
17+
.withResource("sjweb." +Env.get().getName() +".conf")
18+
.withResource("sjweb.conf")
19+
.withResource("cms.application." +Env.get().getName() +".conf")
20+
.withResource("cms.application.conf")
21+
.withResource("application." +Env.get().getName() +".conf")
22+
.withResource("application.conf")
23+
.build();
24+
logger.debug(Json.serializer().toPrettyString(Configs.asMap(config)));
25+
returnconfig;
26+
}
27+
28+
publicstatic <T>voidrun(Runnablerunnable) {
29+
try {
30+
Configs.initProperties(getConfig());
31+
runnable.run();
32+
}catch (Throwableex) {
33+
logger.error("",ex);
34+
}finally {
35+
// Close pools and stuff
36+
}
37+
}
38+
}

‎stubbornjava-webapp/src/main/resources/application.conf‎

Lines changed: 0 additions & 27 deletions
This file was deleted.

‎stubbornjava-webapp/src/main/resources/application.prod.conf‎renamed to ‎stubbornjava-webapp/src/main/resources/sjweb.conf‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
assets.root = "ui/assets"
2+
13
mailchimp {
24
lists {
35
subscribe = "05c0e98feb"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp