Skip to content

Commit

Permalink
fix(Configuration): Correctly load default properties and allow overr…
Browse files Browse the repository at this point in the history
…iding of application properties from serverpackcreator properties.
  • Loading branch information
Griefed committed Mar 2, 2022
1 parent 711bbc5 commit 2f03d33
Show file tree
Hide file tree
Showing 13 changed files with 268 additions and 50 deletions.
95 changes: 95 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,101 @@ The serverpackcreator.conf file allows you to customize a couple of different th

After checking the configuration, run ServerPackCreator again, and it'll do it's magic.

# 5.1 Properties

# 5.1.1 Default `serverpackcreator.properties`

```properties
de.griefed.serverpackcreator.versioncheck.prerelease=false
de.griefed.serverpackcreator.language=en_us
de.griefed.serverpackcreator.configuration.fallbackmodslist=3dSkinLayers-,AdvancementPlaques-,AmbientSounds_,armorchroma-,backtools-,BetterAdvancements-,BetterAnimationsCollection-,BetterDarkMode-,BetterF3-,BetterF3-,BetterFoliage-,BetterPingDisplay-,BetterPlacement-,Blur-,catalogue-,cherishedworlds-,classicbar-,clickadv-,ClientTweaks_,configured-,Controlling-,CraftPresence-,CTM-,customdiscordrpc-,CustomMainMenu-,DefaultOptions_,defaultoptions-,desiredservers-,Ding-,drippyloadingscreen_,drippyloadingscreen-,Durability101-,dynamic-music-,DynamicSurroundings-,DynamicSurroundingsHuds-,dynmus-,EiraMoticons_,eiramoticons-,EnchantmentDescriptions-,EquipmentCompare-,extremesoundmuffler-,extremeSoundMuffler-,Fallingleaves-,fallingleaves-,fancymenu_,findme-,flickerfix-,FpsReducer-,FullscreenWindowed-,InventoryEssentials_,InventorySpam-,InventoryTweaks-,invtweaks-,ItemBorders-,itemzoom,itlt-,jeed-,jehc-,jeiintegration_,JEITweaker-,just-enough-harvestcraft-,justenoughbeacons-,JustEnoughCalculation-,JustEnoughProfessions-,JustEnoughProfessions-,JustEnoughResources-,keywizard-,konkrete_,lazydfu-,LegendaryTooltips-,light-overlay-,LightOverlay-,LLOverlayReloaded-,loadmyresources_,lootbeams-,mcbindtype-,medievalmusic-,modnametooltip_,modnametooltip-,moreoverlays-,MouseTweaks-,multihotbar-,MyServerIsCompatible-,Neat ,NotifMod-,OldJavaWarning-,OptiFine,OptiForge,ornaments-,overloadedarmorbar-,PackMenu-,PickUpNotifier-,Ping-,preciseblockplacing-,presencefootsteps-,PresenceFootsteps-,ReAuth-,ResourceLoader-,shutupexperimentalsettings-,SimpleDiscordRichPresence-,smoothboot-,sounddeviceoptions-,SpawnerFix-,spoticraft-,tconplanner-,timestamps-,Tips-,TipTheScales-,Toast Control-,Toast-Control-,ToastControl-,torchoptimizer-,torohealth-,toughnessbar-,TravelersTitles-,WindowedFullscreen-,WorldNameRandomizer-,yisthereautojump-
de.griefed.serverpackcreator.configuration.hastebinserver=https://haste.zneix.eu/documents
de.griefed.serverpackcreator.serverpack.autodiscoverenabled=true
de.griefed.serverpackcreator.gui.darkmode=true
de.griefed.serverpackcreator.configuration.directories.serverpacks=server-packs
de.griefed.serverpackcreator.curseforge.cleanup.enabled=true
de.griefed.serverpackcreator.serverpack.cleanup.enabled=true
de.griefed.serverpackcreator.serverpack.overwrite.enabled=true
de.griefed.serverpackcreator.configuration.directories.shouldexclude=overrides,packmenu,resourcepacks,server_pack,fancymenu
de.griefed.serverpackcreator.spring.cursecontroller.regenerate.enabled=false
de.griefed.serverpackcreator.spring.schedules.database.cleanup=0 0 0 * * *
de.griefed.serverpackcreator.spring.schedules.files.cleanup=0 0 0 * * *
de.griefed.serverpackcreator.spring.schedules.versions.refresh=0 0 0 * * *
de.griefed.serverpackcreator.spring.artemis.queue.max_disk_usage=90
de.griefed.serverpackcreator.configuration.saveloadedconfig=false
de.griefed.serverpackcreator.configuration.directories.mustinclude=mods,config,defaultconfigs,scripts,saves,seeds,libraries
de.griefed.serverpackcreator.curseforge.api.token=
```

| Property | Description |
|-----------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| de.griefed.serverpackcreator.versioncheck.prerelease | `true` or `false`. Whether to check for available pre-releases, too, when checking for updates. |
| de.griefed.serverpackcreator.language | The language in which ServerPackCreator should run. |
| de.griefed.serverpackcreator.configuration.fallbackmodslist | Comma separated fallback-list of clientside-only mods. |
| de.griefed.serverpackcreator.configuration.hastebinserver | Address of a HasteBin server to use for config and logs uploading. |
| de.griefed.serverpackcreator.serverpack.autodiscoverenabled | `true` or `false`. Whether to try and determine sideness of mods in a modpack automatically. |
| de.griefed.serverpackcreator.gui.darkmode | GUI-only. `true` or `false`. Whether to use dark-mode in the GUI. |
| de.griefed.serverpackcreator.configuration.directories.serverpacks | The directory in which server packs will be generated and stored in. |
| de.griefed.serverpackcreator.curseforge.cleanup.enabled | `true` or `false`. Whether to cleanup files after generating a server pack from a CurseForge project. |
| de.griefed.serverpackcreator.serverpack.cleanup.enabled | `true` or `false`. Whether to cleanup files after generating a server pack. |
| de.griefed.serverpackcreator.serverpack.overwrite.enabled | `true` or `false`. Whether an already existing server pack should be overwritten. |
| de.griefed.serverpackcreator.configuration.directories.shouldexclude | List of directories which should not be in a server pack. |
| de.griefed.serverpackcreator.spring.cursecontroller.regenerate.enabled | `true` or `false`. Web only. Whether regeneration of an already available CurseForge project server pack is allowed/enabled. |
| de.griefed.serverpackcreator.spring.schedules.database.cleanup | Web-only. Cron-schedule at which checks are run and server packs cleaned up. |
| de.griefed.serverpackcreator.spring.schedules.files.cleanup | Web-only. Cron-schedule at which checks are run and files from server pack generations are cleaned up. |
| de.griefed.serverpackcreator.spring.schedules.versions.refresh | Web-only. Cron-schedule at which the available Minecraft, Forge and Fabric versions are refreshed. |
| de.griefed.serverpackcreator.spring.artemis.queue.max_disk_usage | Web-only. Maximum disk usage in percent at which no new tasks are accepted, preventing the generation of new server packs. |
| de.griefed.serverpackcreator.configuration.saveloadedconfig | GUI-only. `true` or `false`. Whether to overwrite the last manually loaded configuration file, too. |
| de.griefed.serverpackcreator.configuration.directories.mustinclude | List of directories which must be included in a server pack. |
| de.griefed.serverpackcreator.curseforge.api.token | CurseAPI token used for generating server packs from CurseForge projects. |

# 5.1.2 Default `application.properties`

`application.properties`
```properties
server.port=8080
server.error.whitelabel.enabled=false
server.tomcat.basedir=.
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.directory=logs
server.tomcat.accesslog.file-date-format=_yyyy-MM-dd
server.tomcat.accesslog.prefix=tomcat_access
server.tomcat.accesslog.suffix=.log
server.tomcat.accesslog.pattern=common
spring.output.ansi.enabled=ALWAYS
server.error.include-message=ALWAYS
server.error.include-stacktrace=ALWAYS
spring.application.name=ServerPackCreator
spring.datasource.url=jdbc:sqlite:serverpackcreator.db
spring.datasource.driver-class-name=org.sqlite.JDBC
spring.jpa.hibernate.ddl-auto=update
spring.jpa.database-platform=org.sqlite.hibernate.dialect.SQLiteDialect
spring.jpa.open-in-view=false
spring.jdbc.template.query-timeout=3600
spring.transaction.default-timeout=3600
spring.artemis.mode=embedded
spring.artemis.embedded.persistent=true
spring.artemis.embedded.data-directory=work/artemis
spring.datasource.tomcat.max-active=50
spring.datasource.tomcat.max-idle=15
spring.datasource.tomcat.min-idle=8
spring.servlet.multipart.max-file-size=500MB
spring.servlet.multipart.max-request-size=500MB
spring.config.import=optional:file:./serverpackcreator.properties
```

If a property above has no description in the table below, it is not to be touched. Changing any of these can break ServerPackCreator or cause otherwise unwanted behaviour.
Changes to properties not described below are not supported. If you changed a property you were not meant to fiddle around with, do not report an issue. Such issues will be closed without further comment.

| Property | Description |
| -------- |--------------------------------------------------------------------------------------------------------|
| server.port | The port at which ServerPackCreator as a webservice will be available at. |
| spring.datasource.url | Path to and name of the SQLite database which the webservice will use. |
| spring.artemis.embedded.data-directory | The path to and name of the directory in which Artemis will store queues and task related information. |
| spring.servlet.multipart.max-file-size | Maximum filesize for uploads. |
| spring.servlet.multipart.max-request-size | Maximum request size for file uploads. |
| spring.config.import | Additional properties-file to import properties from. |

---

# 6. Running
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public class ApplicationProperties extends Properties {
public final File FILE_WINDOWS = new File("start.bat");
public final File FILE_LINUX = new File("start.sh");
public final File FILE_FORGE_ONE_SEVEN_USER_JVM_ARGS = new File("user_jvm_args.txt");
public final Path PLUGINS_DIRECTORY;
private final String FALLBACK_MODS_DEFAULT_ASSTRING =
"3dSkinLayers-," +
"AdvancementPlaques-," +
Expand Down Expand Up @@ -390,8 +389,6 @@ public ApplicationProperties() {
this.serverPackCreatorVersion = "dev";
}

this.PLUGINS_DIRECTORY = Paths.get(getProperty("de.griefed.serverpackcreator.plugins.directory","./plugins"));

try {
this.isCurseForgeActivated = testCurseApiToken();
} catch (IOException ex) {
Expand Down Expand Up @@ -639,7 +636,6 @@ public String toString() {
", FILE_WINDOWS=" + FILE_WINDOWS +
", FILE_LINUX=" + FILE_LINUX +
", FILE_FORGE_ONE_SEVEN_USER_JVM_ARGS=" + FILE_FORGE_ONE_SEVEN_USER_JVM_ARGS +
", PLUGINS_DIRECTORY=" + PLUGINS_DIRECTORY +
", LIST_FALLBACK_MODS_DEFAULT=" + LIST_FALLBACK_MODS_DEFAULT +
", FILE_CONFIG=" + FILE_CONFIG +
", FILE_CONFIG_OLD=" + FILE_CONFIG_OLD +
Expand Down
4 changes: 3 additions & 1 deletion backend/main/java/de/griefed/serverpackcreator/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ public static void main(String[] args) {
HashMap<String, String> systemInformation = jarUtilities.systemInformation(jarUtilities.getApplicationHomeForClass(Main.class));

jarUtilities.copyFileFromJar(log4j2xml);
try { properties.createNewFile(); } catch (IOException ex) {
try {
properties.createNewFile();
} catch (IOException ex) {
LOG.error("Couldn't create empty serverpackcreator.properties.");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
* @author Griefed
*/
@SpringBootApplication
@EnableScheduling
@PropertySources({
@PropertySource("classpath:application.properties"),
@PropertySource(value = "file:./serverpackcreator.properties", ignoreResourceNotFound = true),
@PropertySource(value = "file:./application.properties", ignoreResourceNotFound = true)
@PropertySource("classpath:serverpackcreator.properties")
})
public class MainSpringBoot {

Expand Down
44 changes: 44 additions & 0 deletions backend/main/resources/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,47 @@
## [3.0.0-beta.7](https://git.griefed.de/Griefed/ServerPackCreator/compare/3.0.0-beta.6...3.0.0-beta.7) (2022-02-27)


### 💎 Improvements

* **Strings:** Strengthen configuration checks by making sure some strings do not contain backslashes. Make server pack suffix more secure by removing illegal characters. ([04b76c9](https://git.griefed.de/Griefed/ServerPackCreator/commit/04b76c93b6dd1955440b247f3542d0729d4af7b7))


### 🦊 CI/CD

* **deps:** bump edu.sc.seis.launch4j from 2.5.1 to 2.5.2 ([59051b9](https://git.griefed.de/Griefed/ServerPackCreator/commit/59051b927831a6e09ee3b0a491b014c4d67a6034))
* **deps:** bump log4j-api from 2.17.1 to 2.17.2 ([2984f46](https://git.griefed.de/Griefed/ServerPackCreator/commit/2984f46d7ce916705c9fc537ddeb1b13a3b4355a))
* **deps:** bump log4j-core from 2.17.1 to 2.17.2 ([06c0dd6](https://git.griefed.de/Griefed/ServerPackCreator/commit/06c0dd6f2848484b9e97e3a441b8dcd893ce144a))
* **deps:** bump log4j-jul from 2.17.1 to 2.17.2 ([2f38947](https://git.griefed.de/Griefed/ServerPackCreator/commit/2f38947cde6546126a08e1716174fd1d0ea70520))
* **deps:** bump log4j-slf4j-impl from 2.17.1 to 2.17.2 ([0a9099b](https://git.griefed.de/Griefed/ServerPackCreator/commit/0a9099bdd28c88f2a8e040a9cc558bb82dc84cda))
* **deps:** bump log4j-web from 2.17.1 to 2.17.2 ([e76c049](https://git.griefed.de/Griefed/ServerPackCreator/commit/e76c049e05342c0aa3ff41076db12bd6ca36df5c))
* **deps:** bump org.springframework.boot from 2.6.3 to 2.6.4 ([f9e0d1a](https://git.griefed.de/Griefed/ServerPackCreator/commit/f9e0d1af4051320b368eb31872881bc79759b334))
* **deps:** bump spring-boot-devtools from 2.6.3 to 2.6.4 ([077e0b4](https://git.griefed.de/Griefed/ServerPackCreator/commit/077e0b4a387c912de8990469f54bb238fdef05d4))
* **deps:** bump spring-boot-starter-artemis from 2.6.3 to 2.6.4 ([7b651ca](https://git.griefed.de/Griefed/ServerPackCreator/commit/7b651ca2bf8efbaf84b14d5465b8a739c74c2743))
* **deps:** bump spring-boot-starter-data-jpa from 2.6.3 to 2.6.4 ([74a7ada](https://git.griefed.de/Griefed/ServerPackCreator/commit/74a7adab6934bd62cd55a356ebc9cde1ec86a606))
* **deps:** bump spring-boot-starter-log4j2 from 2.6.3 to 2.6.4 ([536134d](https://git.griefed.de/Griefed/ServerPackCreator/commit/536134d96b352227981c37215f72ce5336f6af27))
* **deps:** bump spring-boot-starter-quartz from 2.6.3 to 2.6.4 ([2211d4d](https://git.griefed.de/Griefed/ServerPackCreator/commit/2211d4d67bc7bc14097859a879e78270dcb80902))
* **deps:** bump spring-boot-starter-test from 2.6.3 to 2.6.4 ([f27d94d](https://git.griefed.de/Griefed/ServerPackCreator/commit/f27d94d6942a241bdf13948940c7c454921f020c))
* **deps:** bump spring-boot-starter-validation from 2.6.3 to 2.6.4 ([9f66c07](https://git.griefed.de/Griefed/ServerPackCreator/commit/9f66c0711de1a88bdb555dcc15fe3c009b9df8de))
* **deps:** bump spring-boot-starter-web from 2.6.3 to 2.6.4 ([c017e87](https://git.griefed.de/Griefed/ServerPackCreator/commit/c017e87f03cdce98511b271ddf084fba372dee85))


### 🛠 Fixes

* **UpdateChecker:** Update VersionChecker to 1.0.7 and refactor UpdateChecker to DI to prevent false positives and correctly check for available updates. ([341d2d1](https://git.griefed.de/Griefed/ServerPackCreator/commit/341d2d1403922df2f685ad94d1a996eac6645645))


### Other

* **deps:** update actions/setup-java action to v3 ([90a6baf](https://git.griefed.de/Griefed/ServerPackCreator/commit/90a6baf68ab7a4f73e8da5c74dfa92eb686a79b9))
* **deps:** update dependency @typescript-eslint/eslint-plugin to v5.12.1 ([c58b2a0](https://git.griefed.de/Griefed/ServerPackCreator/commit/c58b2a0722e9a80322c9a88170dd7d20246ff6b4))
* **deps:** update dependency eslint to v8.10.0 ([2e5f498](https://git.griefed.de/Griefed/ServerPackCreator/commit/2e5f4985b73024908e94acb9d1f4a75d3e10dc94))
* **deps:** update dependency eslint-plugin-vue to v8.5.0 ([b30b829](https://git.griefed.de/Griefed/ServerPackCreator/commit/b30b829d56525606d1f365abdbbc8f3e70f31699))
* **deps:** update dependency ghcr.io/griefed/baseimage-ubuntu-jdk-8 to v2.0.6 ([5941f91](https://git.griefed.de/Griefed/ServerPackCreator/commit/5941f9133f29623800d46da9fedd419c2618645a))
* **deps:** update dependency ghcr.io/griefed/gitlab-ci-cd to v2.0.3 ([bad28e8](https://git.griefed.de/Griefed/ServerPackCreator/commit/bad28e82029e6e4e429a0e8468551d99265095c0))
* **deps:** update dependency tsparticles to v1.41.5 ([71fd7cb](https://git.griefed.de/Griefed/ServerPackCreator/commit/71fd7cb1d1b6a4589f44ae201cd42c78c0aefccd))
* **deps:** update plugin edu.sc.seis.launch4j to v2.5.2 ([4e515f4](https://git.griefed.de/Griefed/ServerPackCreator/commit/4e515f41687b5c13fa1a431ee5f664dc9f7748c3))
* **deps:** update spring boot to v2.6.4 ([7ceabfc](https://git.griefed.de/Griefed/ServerPackCreator/commit/7ceabfc1acf20f1f388209108255958bc74e6101))

## [3.0.0-beta.6](https://git.griefed.de/Griefed/ServerPackCreator/compare/3.0.0-beta.5...3.0.0-beta.6) (2022-02-25)


Expand Down
Loading

0 comments on commit 2f03d33

Please sign in to comment.