Skip to content

Commit 8cd2039

Browse files
committed
Added a user-configurable external properties file [#2437]
Moved the properties that users shouldn't touch into an internal properties file to make it easier to add new features without requiring the user to update their configuration.
1 parent c145737 commit 8cd2039

File tree

3 files changed

+81
-78
lines changed

3 files changed

+81
-78
lines changed

comixed-app/src/main/java/org/comixedproject/ComiXedConfiguration.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import org.springframework.cache.annotation.EnableCaching;
2222
import org.springframework.context.annotation.Configuration;
23+
import org.springframework.context.annotation.PropertySource;
2324
import org.springframework.scheduling.annotation.EnableAsync;
2425
import org.springframework.scheduling.annotation.EnableScheduling;
2526
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
@@ -38,4 +39,5 @@
3839
@EnableAsync
3940
@EnableCaching
4041
@EnableMethodSecurity(prePostEnabled = true)
42+
@PropertySource("classpath:/comixed-core.properties")
4143
public class ComiXedConfiguration {}

comixed-app/src/main/resources/application.properties

Lines changed: 2 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,8 @@
1-
spring.application.name=ComiXed
2-
3-
# turn off banner
4-
spring.main.banner-mode=off
5-
6-
# web configuration
7-
server.port=7171
8-
server.servlet.context-path=/
9-
spring.h2.console.enabled=false
10-
spring.h2.console.path=/dbconsole
11-
comixed.auth.jwt-signing-key=comixed-project
12-
13-
# ssl configuration
14-
server.ssl.key-store-type=PKCS12
15-
server.ssl.key-store=classpath:keystore/comixed-keystore.jks
16-
server.ssl.key-store-password=c0m1X3d
17-
server.ssl.key-alias=comixed-key
18-
server.ssl.enabled=false
19-
server.ssl.trust-store=classpath:keystore/comixed-trust.jks
20-
server.ssl.trust-store-password=c0m1X3d
21-
22-
# runtime management settings
23-
management.endpoints.web.exposure.include=health,info,shutdown,metrics
24-
management.endpoint.shutdown.enabled=true
25-
management.endpoint.health.show-details=always
1+
# The user-configured properties for ComiXed
262

273
# image caching directory
284
comixed.images.cache.location=${user.home}/.comixed/image-cache
295

30-
# Common JPA Configuration
31-
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
32-
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
33-
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
34-
spring.jpa.show-sql=true
35-
spring.jpa.generate-ddl=false
36-
spring.jpa.hibernate.ddl-auto=none
37-
386
# To select another database in place of the embedded server, simply
397
# comment out the H2 configuration below and uncomment the options
408
# for the database to user, and replace the default configured values
@@ -58,51 +26,7 @@ spring.datasource.url=jdbc:h2:file:~/.comixed/comixed
5826
# spring.datasource.url=jdbc:postgresql://hostname:5432/comixed
5927

6028
spring.datasource.username=sa
61-
spring.database.password=
62-
63-
# Hikari Connection Pool Settings
64-
spring.datasource.hikari.connection-timeout=30000
65-
spring.datasource.hikari.idle-timeout=30000
66-
spring.datasource.hikari.pool-name=CX-Conn-Pool
67-
68-
# Session storage
69-
spring.session.store-type=jdbc
70-
spring.session.jdbc.initialize-schema=always
71-
72-
# Batch processing
73-
spring.batch.jdbc.initialize-schema=always
74-
spring.batch.job.enabled=true
75-
spring.batch.job.name=processUnhashedComicsJob
76-
spring.batch.jdbc.isolation-level-for-create=repeatable_read
77-
comixed.batch.thread-pool-size=-1
78-
comixed.batch.page-reader.chunk-size=1
79-
comixed.batch.add-image-cache-entries.chunk-size=1
80-
comixed.batch.metadata-process.chunk-size=10
81-
comixed.batch.purge-library.period=60000
82-
comixed.batch.purge-library.chunk-size=1
83-
comixed.batch.recreate-comic-files.period=60000
84-
comixed.batch.recreate-comic-files.chunk-size=1
85-
comixed.batch.update-comic-metadata.chunk-size=1
86-
comixed.batch.add-cover-to-image-cache.schedule=0 0 * * * *
87-
comixed.batch.add-cover-to-image-cache.chunk-size=1
88-
comixed.batch.process-comic-books.period=60000
89-
comixed.batch.process-comic-books.chunk-size=10
90-
comixed.batch.load-page-hashes.period=60000
91-
comixed.batch.load-page-hashes.chunk-size=10
92-
comixed.batch.mark-blocked-pages.period=60000
93-
comixed.batch.mark-blocked-pages.chunk-size=1
94-
comixed.batch.organize-library.period=60000
95-
comixed.batch.organize-library.chunk-size=1
96-
comixed.batch.scrape-metadata.schedule=0 0 3 * * *
97-
comixed.batch.scrape-metadata.chunk-size=10
98-
comixed.batch.update-metadata.period=60000
99-
comixed.batch.update-metadata.chunk-size=10
100-
101-
# Liquibase changelog
102-
spring.liquibase.change-log=classpath:db/liquibase-changelog.xml
103-
104-
# Jackson JSON handling
105-
spring.jackson.deserialization.fail-on-unknown-properties=false
29+
spring.datasource.password=
10630

10731
# Logging
10832
logging.file.name=${user.home}/.comixed/comixed.log
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
spring.application.name=ComiXed
2+
3+
# turn off banner
4+
spring.main.banner-mode=off
5+
6+
# web configuration
7+
server.port=7171
8+
server.servlet.context-path=/
9+
spring.h2.console.enabled=false
10+
spring.h2.console.path=/dbconsole
11+
comixed.auth.jwt-signing-key=comixed-project
12+
13+
# ssl configuration
14+
server.ssl.key-store-type=PKCS12
15+
server.ssl.key-store=classpath:keystore/comixed-keystore.jks
16+
server.ssl.key-store-password=c0m1X3d
17+
server.ssl.key-alias=comixed-key
18+
server.ssl.enabled=false
19+
server.ssl.trust-store=classpath:keystore/comixed-trust.jks
20+
server.ssl.trust-store-password=c0m1X3d
21+
22+
# runtime management settings
23+
management.endpoints.web.exposure.include=health,info,shutdown,metrics
24+
management.endpoint.shutdown.access=unrestricted
25+
management.endpoint.health.show-details=always
26+
27+
# Common JPA Configuration
28+
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
29+
spring.jpa.hibernate.naming.implicit-strategy=org.hibernate.boot.model.naming.ImplicitNamingStrategyLegacyJpaImpl
30+
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
31+
spring.jpa.show-sql=true
32+
spring.jpa.generate-ddl=false
33+
spring.jpa.hibernate.ddl-auto=none
34+
35+
# Hikari Connection Pool Settings
36+
spring.datasource.hikari.connection-timeout=30000
37+
spring.datasource.hikari.idle-timeout=30000
38+
spring.datasource.hikari.pool-name=CX-Conn-Pool
39+
40+
# Session storage
41+
spring.session.store-type=jdbc
42+
spring.session.jdbc.initialize-schema=always
43+
44+
# Batch processing
45+
spring.batch.jdbc.initialize-schema=always
46+
spring.batch.job.enabled=true
47+
spring.batch.job.name=processUnhashedComicsJob
48+
spring.batch.jdbc.isolation-level-for-create=repeatable_read
49+
comixed.batch.thread-pool-size=-1
50+
comixed.batch.page-reader.chunk-size=1
51+
comixed.batch.add-image-cache-entries.chunk-size=1
52+
comixed.batch.metadata-process.chunk-size=10
53+
comixed.batch.purge-library.period=60000
54+
comixed.batch.purge-library.chunk-size=1
55+
comixed.batch.recreate-comic-files.period=60000
56+
comixed.batch.recreate-comic-files.chunk-size=1
57+
comixed.batch.update-comic-metadata.chunk-size=1
58+
comixed.batch.add-cover-to-image-cache.schedule=0 0 * * * *
59+
comixed.batch.add-cover-to-image-cache.chunk-size=1
60+
comixed.batch.process-comic-books.period=60000
61+
comixed.batch.process-comic-books.chunk-size=10
62+
comixed.batch.load-page-hashes.period=60000
63+
comixed.batch.load-page-hashes.chunk-size=10
64+
comixed.batch.mark-blocked-pages.period=60000
65+
comixed.batch.mark-blocked-pages.chunk-size=1
66+
comixed.batch.organize-library.period=60000
67+
comixed.batch.organize-library.chunk-size=1
68+
comixed.batch.scrape-metadata.schedule=0 0 3 * * *
69+
comixed.batch.scrape-metadata.chunk-size=10
70+
comixed.batch.update-metadata.period=60000
71+
comixed.batch.update-metadata.chunk-size=10
72+
73+
# Liquibase changelog
74+
spring.liquibase.change-log=classpath:db/liquibase-changelog.xml
75+
76+
# Jackson JSON handling
77+
spring.jackson.deserialization.fail-on-unknown-properties=false

0 commit comments

Comments
 (0)