Add WebgitProperties configuration

Add configuration properties class with worktreePath and gitDirPath
settings, and JGit dependency.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-26 08:40:17 +01:00
parent 47c7841017
commit a7d03b3410
4 changed files with 131 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
package be.seeseepuff.webgit.config;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.nio.file.Path;
@Component
@ConfigurationProperties(prefix = "webgit")
@Getter
@Setter
public class WebgitProperties
{
private Path worktreePath;
private Path gitDirPath;
}

View File

@@ -0,0 +1,33 @@
package be.seeseepuff.webgit.config;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
import java.nio.file.Path;
import static org.junit.jupiter.api.Assertions.*;
@SpringBootTest
@TestPropertySource(properties = {
"webgit.worktree-path=/mnt/shared/repos",
"webgit.git-dir-path=/var/lib/webgit/git"
})
class WebgitPropertiesTest
{
@Autowired
private WebgitProperties properties;
@Test
void worktreePathIsBound()
{
assertEquals(Path.of("/mnt/shared/repos"), properties.getWorktreePath());
}
@Test
void gitDirPathIsBound()
{
assertEquals(Path.of("/var/lib/webgit/git"), properties.getGitDirPath());
}
}