fix godforsaken nullpointer issue caused by missing ssl config values in default config

This commit is contained in:
Gregor Lohaus
2026-02-25 20:32:09 +01:00
parent 5d5003d4ae
commit 84a255abac
4 changed files with 71 additions and 4 deletions

View File

@@ -20,6 +20,7 @@ repositories {
}
dependencies {
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'

View File

@@ -5,9 +5,9 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import com.gregor_lohaus.gtransfer.config.types.Config;
// import com.google.gson.Gson;
// import com.google.gson.GsonBuilder;
import org.springframework.boot.EnvironmentPostProcessor;
// import org.springframework.boot.env.EnvironmentPostProcessor;
import org.springframework.boot.SpringApplication;
import org.springframework.core.env.ConfigurableEnvironment;
@@ -41,6 +41,10 @@ public class ConfigEnvironmentPostProcessor implements EnvironmentPostProcessor
System.exit(1);
}
Config defaultConfig = DefaultConfig.config;
// Gson gson = new GsonBuilder().setPrettyPrinting().serializeNulls().create();
// String json = gson.toJson(defaultConfig);
// System.out.println(json);
table = ConfigSerializer.toToml(defaultConfig);
toml.write(CONFIG_FILE_PATH, table);
}

View File

@@ -50,6 +50,8 @@ public class DefaultConfig {
svc2.port = 8080;
SslConfig ssl = new SslConfig();
ssl.enabled = false;
ssl.certificatePrivateKey = "";
ssl.certificate = "";
svc2.sslConfig = ssl;
c.serverConfig = svc2;

View File

@@ -17,6 +17,62 @@
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1767039857,
"owner": "NixOS",
"repo": "flake-compat",
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "flake-compat",
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1772024342,
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "6e34e97ed9788b17796ee43ccdbaf871a5c2b476",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1762808025,
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "cb5e3fdca1de58ccbc3ef53de65bd372b48f567c",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"inputs": {
"nixpkgs-src": "nixpkgs-src"
@@ -56,10 +112,14 @@
"root": {
"inputs": {
"devenv": "devenv",
"nixpkgs": "nixpkgs"
"git-hooks": "git-hooks",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": [
"git-hooks"
]
}
}
},
"root": "root",
"version": 7
}
}